/* ARLS Estrela do Oriente Nº 127 — Gestão da Loja */

body {
  margin: 0;
  background: #e8e6e1;
  --bgpage: #e8e6e1;
  --bg: #f7f6f3;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #68707f;
  --line: rgba(28, 35, 51, .1);
  --primary: #1e2d4f;
  --primink: #f7f6f3;
  --prim2: #3e5488;
  --primsoft: rgba(30, 45, 79, .08);
  --gold: #a8863c;
  --goldsoft: rgba(168, 134, 60, .13);
  --green: #2e7d4f;
  --greensoft: rgba(46, 125, 79, .12);
  --red: #b23a3a;
  --redsoft: rgba(178, 58, 58, .1);
  --shadow: 0 1px 3px rgba(28, 35, 51, .05), 0 8px 24px rgba(28, 35, 51, .05);
}

body.dark {
  background: #0c0e14;
  --bgpage: #0c0e14;
  --bg: #12151f;
  --card: #1a1e2b;
  --ink: #e9e7e0;
  --muted: #969dad;
  --line: rgba(233, 231, 224, .1);
  --primary: #33436e;
  --primink: #f2f1ec;
  --prim2: #9db1e0;
  --primsoft: rgba(157, 177, 224, .12);
  --gold: #c9a558;
  --goldsoft: rgba(201, 165, 88, .14);
  --green: #57b586;
  --greensoft: rgba(87, 181, 134, .14);
  --red: #d97070;
  --redsoft: rgba(217, 112, 112, .12);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

a { color: var(--gold); }
a:hover { color: var(--prim2); }

input, select, button { font-family: inherit; }
input::placeholder { color: var(--muted); opacity: .7; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

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

/* ---------- shell ---------- */

:root {
  /* Safe areas (notch / Dynamic Island / home indicator). Resolve to 0 on
     devices without insets, so these are harmless on desktop. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  /* Side breathing room, widened by any notch inset in landscape. */
  --gutter-l: max(24px, var(--safe-l));
  --gutter-r: max(24px, var(--safe-r));
}

.app-root {
  min-height: 100dvh;
  background: var(--bgpage);
  display: flex;
  justify-content: center;
  font-family: 'Albert Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink);
}

.phone {
  width: 100%;
  max-width: 430px;
  /* iOS Safari mis-reports dvh mid-scroll as the URL bar collapses, which lets
     the absolutely-positioned tabbar drift out of view. Pin to the small
     viewport (svh) — stable across that transition — and let dvh/100% serve as
     progressive fallbacks for browsers without svh. */
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, .1);
}

.screen { animation: fadeUp .3s ease; }

.hidden { display: none !important; }

/* ---------- login ---------- */

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(32px + var(--safe-t)) max(28px, var(--gutter-r))
           calc(32px + var(--safe-b)) max(28px, var(--gutter-l));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.crest-ring {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.crest {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary);
  color: #ead9b0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: Lora, serif;
}

.crest span { font-size: 22px; letter-spacing: 1px; }

.lodge-name {
  font-family: Lora, serif;
  font-size: 20px;
  font-weight: 600;
}

.lodge-or {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: .4px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold);
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  outline: none;
}

.input:focus { border-color: var(--gold); }

.input--search { padding: 13px 15px; font-size: 14.5px; }

.alert-error {
  background: var(--redsoft);
  color: var(--red);
  font-size: 13px;
  padding: 11px 13px;
  border-radius: 10px;
  font-weight: 500;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: var(--primink);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .2px;
}

.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: scale(.985); }

.link-quiet {
  text-align: center;
  font-size: 13.5px;
  color: var(--gold);
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  width: 100%;
}

.login__note {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 40px;
}

/* ---------- top bar ---------- */

.topbar {
  /* The top inset must be ADDED to the padding, not max()'d with it: max()
     would consume the whole inset as padding and leave the content flush
     against the status bar / Dynamic Island. */
  padding: calc(16px + var(--safe-t)) var(--gutter-r) 12px var(--gutter-l);
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.topbar__crest {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #ead9b0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Lora, serif;
  font-size: 14px;
  letter-spacing: .5px;
  flex: none;
}

.topbar__text { flex: 1; min-width: 0; }

.topbar__name {
  font-family: Lora, serif;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__or { font-size: 11px; color: var(--muted); }

.switch {
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: rgba(28, 35, 51, .22);
  position: relative;
  cursor: pointer;
  flex: none;
  border: none;
  padding: 0;
  transition: background .2s;
}

body.dark .switch { background: var(--gold); }

.switch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: left .2s;
}

body.dark .switch__knob { left: 20px; }

/* ---------- scroll body ---------- */

.tabbody {
  flex: 1;
  overflow-y: auto;
  /* Bottom clearance = tabbar height + home indicator, so the last card is
     never trapped underneath it. */
  padding: 4px var(--gutter-r) calc(96px + var(--safe-b)) var(--gutter-l);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack--tight { gap: 12px; }

.page-title {
  font-family: Lora, serif;
  font-size: 22px;
  font-weight: 600;
  padding: 2px 4px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card--pad { padding: 16px; }
.card--list { padding: 6px 16px; }

.card__title {
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 0 4px;
}

/* ---------- dashboard ---------- */

.greet {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 4px;
  flex-wrap: wrap;
}

.greet__name {
  font-family: Lora, serif;
  font-size: 22px;
  font-weight: 600;
}

.pill-gold {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--goldsoft);
  padding: 3px 8px;
  border-radius: 20px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  box-shadow: var(--shadow);
}

.stat__label { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.stat__value {
  font-family: Lora, serif;
  font-size: 27px;
  font-weight: 600;
  margin-top: 3px;
}

.stat__note {
  font-size: 11px;
  color: var(--gold);
  margin-top: 2px;
  font-weight: 500;
}

.quick {
  padding: 13px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow);
}

.quick:hover { border-color: var(--gold); }

.quick__icon { font-size: 18px; line-height: 1; color: var(--gold); }

.quick--solid {
  border: none;
  background: var(--primary);
  color: var(--primink);
  box-shadow: none;
}

.quick--solid:hover { filter: brightness(1.12); border-color: transparent; }
.quick--solid .quick__icon { color: inherit; font-weight: 400; }

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chart-head__note { font-size: 11.5px; color: var(--muted); }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  height: 110px;
  margin-top: 16px;
}

.bars--sm { height: 100px; margin-top: 14px; }

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar__v { font-size: 10px; color: var(--muted); font-weight: 600; }

.bar__fill {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: var(--primsoft);
}

.bar__fill--hl { background: var(--gold); }

.bar__m { font-size: 10.5px; color: var(--muted); }

.feed-row {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: flex-start;
}

.feed-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 5px;
  flex: none;
}

.feed-row__t { font-size: 13px; line-height: 1.45; }
.feed-row__q { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- segmented ---------- */

.seg {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}

.seg__btn {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  border: none;
}

.seg__btn.is-active { background: var(--primary); color: var(--primink); }

/* ---------- sessions ---------- */

.session-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}

.session-row:hover { border-color: var(--gold); }

.datechip {
  width: 52px;
  flex: none;
  text-align: center;
  background: var(--primsoft);
  border-radius: 10px;
  padding: 8px 0;
}

.datechip__d {
  font-family: Lora, serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--prim2);
  line-height: 1;
}

.datechip__m {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  margin-top: 3px;
}

.session-row__body { flex: 1; min-width: 0; }
.session-row__title { font-size: 14.5px; font-weight: 600; }
.session-row__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.chev { color: var(--muted); font-size: 18px; }

/* ---------- members ---------- */

.row-between {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 4px;
}

.count-note { font-size: 12px; color: var(--muted); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
}

.chip.is-active {
  background: var(--primary);
  color: var(--primink);
  border-color: var(--primary);
}

.list-card { overflow: hidden; }

.member-row {
  display: flex;
  gap: 12px;
  padding: 13px 15px;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  width: 100%;
  background: none;
  text-align: left;
  color: inherit;
  font: inherit;
  border-left: none;
  border-right: none;
  border-top: none;
}

.member-row:hover { background: var(--primsoft); }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primsoft);
  color: var(--prim2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 700;
  flex: none;
}

.member-row__body { flex: 1; min-width: 0; }

.member-row__name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-row__meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.grau-badge {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 20px;
}

.grau--mestre { background: var(--goldsoft); color: var(--gold); }
.grau--companheiro { background: var(--primsoft); color: var(--prim2); }
.grau--aprendiz { background: var(--greensoft); color: var(--green); }

.empty { padding: 40px 20px; text-align: center; }
.empty__t { font-size: 15px; font-weight: 600; color: var(--muted); }
.empty__s { font-size: 12.5px; color: var(--muted); margin-top: 5px; opacity: .8; }

/* ---------- reports ---------- */

.rank-row {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}

.rank-row__pos {
  font-family: Lora, serif;
  font-size: 15px;
  color: var(--gold);
  width: 20px;
  flex: none;
}

.rank-row__name { flex: 1; font-size: 13.5px; font-weight: 500; }
.rank-row__pct { font-size: 13px; font-weight: 700; color: var(--green); }
.rank-row__pct--low { color: var(--red); }

.dot-red {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}

.btn-outline {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn-outline:hover { border-color: var(--gold); }

/* ---------- settings ---------- */

.group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 16px 6px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  background: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.setting-row:hover { background: var(--primsoft); }
.setting-row--static { cursor: default; }
.setting-row--static:hover { background: none; }

.badge-green {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: var(--greensoft);
  padding: 4px 10px;
  border-radius: 20px;
}

.theme-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.theme-row span { font-size: 14px; font-weight: 500; }

.danger-link {
  text-align: center;
  font-size: 13.5px;
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
  padding: 10px;
  background: none;
  border: none;
  width: 100%;
}

.version {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding-bottom: 8px;
}

/* ---------- tab bar ---------- */

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  /* Bottom padding clears the iPhone home indicator when present. */
  padding: 7px max(6px, var(--safe-r)) max(14px, var(--safe-b)) max(6px, var(--safe-l));
}

.tabbar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0;
  cursor: pointer;
  color: var(--muted);
  background: none;
  border: none;
  font-family: inherit;
}

.tabbar__btn.is-active { color: var(--gold); }
.tabbar__btn span { font-size: 10px; font-weight: 600; }

/* ---------- overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  overflow-y: auto;
  padding: calc(14px + var(--safe-t)) var(--gutter-r) calc(40px + var(--safe-b)) var(--gutter-l);
  animation: fadeUp .25s ease;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.overlay--flex {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  background: none;
  border: none;
  font-family: inherit;
}

/* session detail */

.detail-card {
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.detail-card__grau {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold);
}

.detail-card__tipo {
  font-family: Lora, serif;
  font-size: 22px;
  font-weight: 600;
  margin-top: 5px;
}

.detail-card__meta {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 6px;
}

.presence-block { margin-top: 16px; }

.presence-block__head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.presence-block__head span:last-child { color: var(--green); }

.progress {
  height: 7px;
  border-radius: 4px;
  background: var(--primsoft);
  margin-top: 8px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--green);
  transition: width .25s;
}

.visitor-row {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}

.avatar--gold {
  width: 34px;
  height: 34px;
  background: var(--goldsoft);
  color: var(--gold);
  font-size: 12px;
}

.visitor-row__name { font-size: 13.5px; font-weight: 600; }
.visitor-row__meta { font-size: 11.5px; color: var(--muted); }

.empty-inline {
  padding: 18px 0 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* check-in */

.checkin__head {
  flex: none;
  padding: calc(14px + var(--safe-t)) var(--gutter-r) 12px var(--gutter-l);
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.checkin__navrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.checkin__navtitle { font-size: 13px; font-weight: 600; }
.checkin__navspacer { width: 50px; }

.checkin__count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
}

.checkin__n {
  font-family: Lora, serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--green);
}

.checkin__of { font-size: 13.5px; color: var(--muted); }

.checkin__search { display: flex; gap: 9px; margin-top: 12px; }

.input--inline {
  flex: 1;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--bg);
  font-size: 14px;
}

.btn-qr {
  flex: none;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--gold);
  background: var(--goldsoft);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.checkin__list {
  flex: 1;
  overflow-y: auto;
  padding: 10px var(--gutter-r) calc(100px + var(--safe-b)) var(--gutter-l);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.checkin-row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.checkin-row__body { flex: 1; min-width: 0; }

.checkin-row__name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkin-row__grau { font-size: 11.5px; color: var(--muted); }

.toggle-pres {
  flex: none;
  width: 100px;
  padding: 12px 0;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  transition: all .15s;
}

.toggle-pres:active { transform: scale(.96); }

.toggle-pres.is-present {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.checkin__footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px var(--gutter-r) max(18px, var(--safe-b)) var(--gutter-l);
  background: var(--card);
  border-top: 1px solid var(--line);
}

.btn-primary--lg {
  padding: 16px;
  border-radius: 13px;
  font-size: 15.5px;
}

/* member profile */

.profile-head {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
}

.profile-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary);
  color: #ead9b0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Lora, serif;
  font-size: 26px;
}

.profile-name {
  font-family: Lora, serif;
  font-size: 20px;
  font-weight: 600;
}

.profile-cargo {
  font-size: 12.5px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 3px;
}

.grau-badge--lg {
  font-size: 11px;
  letter-spacing: .6px;
  padding: 5px 12px;
}

.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.metric__v {
  font-family: Lora, serif;
  font-size: 21px;
  font-weight: 600;
}

.metric__v--green { color: var(--green); }
.metric__l { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  gap: 12px;
}

.info-row__k { color: var(--muted); flex: none; }
.info-row__v { font-weight: 600; text-align: right; }

.hist-row {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}

.hist-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hist-dot--ok { background: var(--green); }
.hist-dot--no { background: var(--red); }

.hist-row__tipo { font-size: 13.5px; font-weight: 500; }
.hist-row__data { font-size: 11.5px; color: var(--muted); }
.hist-row__label { font-size: 12px; font-weight: 700; }
.hist-row__label--ok { color: var(--green); }
.hist-row__label--no { color: var(--red); }

.btn-outline--full {
  margin-top: 12px;
  width: 100%;
  padding: 15px;
  font-size: 14px;
}

/* visitor form */

.form-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.form-stack { display: flex; flex-direction: column; gap: 13px; margin-top: 18px; }

.btn-generate {
  margin-top: 6px;
  width: 100%;
  padding: 16px;
  border-radius: 13px;
  border: none;
  background: var(--primsoft);
  color: var(--muted);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.btn-generate.is-ready { background: var(--primary); color: var(--primink); }
.btn-generate:active { transform: scale(.985); }

.form-note {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

/* certificate */

.success-banner {
  margin-top: 8px;
  background: var(--greensoft);
  border: 1px solid var(--green);
  border-radius: 13px;
  padding: 13px 15px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.success-banner__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.success-banner__t { font-size: 13.5px; font-weight: 700; color: var(--green); }
.success-banner__s { font-size: 11.5px; color: var(--muted); }

.style-chips { display: flex; gap: 8px; margin-top: 14px; }

.style-chip {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
}

.style-chip.is-active {
  background: var(--primary);
  color: var(--primink);
  border-color: var(--primary);
}

/* certificates keep a fixed light palette — they are printable documents */

.cert-classic {
  margin-top: 12px;
  background: #fdfbf4;
  border-radius: 6px;
  padding: 9px;
  box-shadow: var(--shadow);
}

.cert-classic__outer { border: 1.5px solid #a8863c; padding: 3px; }

.cert-classic__inner {
  border: 1px solid #d3c294;
  padding: 22px 18px;
  text-align: center;
  color: #26304a;
}

.cert-classic__arls {
  font-size: 9.5px;
  letter-spacing: 2.5px;
  font-weight: 600;
  color: #a8863c;
}

.cert-classic__lodge {
  font-family: Lora, serif;
  font-size: 17px;
  font-weight: 600;
  margin-top: 4px;
}

.cert-classic__or {
  font-size: 9.5px;
  color: #7a7460;
  margin-top: 3px;
  letter-spacing: .5px;
}

.cert-classic__rule {
  width: 52px;
  height: 1px;
  background: #a8863c;
  margin: 14px auto;
}

.cert-classic__title {
  font-family: Lora, serif;
  font-style: italic;
  font-size: 19px;
  color: #a8863c;
}

.cert-classic__body {
  font-size: 11.5px;
  line-height: 1.75;
  margin-top: 12px;
  color: #3a4053;
}

.cert-classic__place { font-size: 10.5px; color: #7a7460; margin-top: 14px; }

.cert-classic__sign {
  margin: 20px auto 0;
  width: 170px;
  border-top: 1px solid #26304a;
  padding-top: 6px;
}

.cert-sign__name { font-size: 11px; font-weight: 600; }
.cert-sign__role { font-size: 9.5px; color: #7a7460; }

.cert-classic__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 18px;
}

.cert-val__label {
  font-size: 8.5px;
  color: #7a7460;
  letter-spacing: .5px;
  text-align: left;
}

.cert-val__code {
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 600;
  margin-top: 2px;
  text-align: left;
}

.qr-box {
  width: 44px;
  height: 44px;
  border: 1px solid #26304a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, monospace;
  font-size: 9px;
  color: #7a7460;
  flex: none;
}

.cert-modern {
  margin-top: 12px;
  background: #ffffff;
  border-radius: 14px;
  padding: 24px 22px;
  box-shadow: var(--shadow);
  color: #1c2333;
}

.cert-modern__head { display: flex; align-items: center; gap: 10px; }

.cert-modern__crest {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e2d4f;
  color: #ead9b0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Lora, serif;
  font-size: 12px;
  flex: none;
}

.cert-modern__lodge { font-size: 12.5px; font-weight: 700; }
.cert-modern__or { font-size: 10px; color: #68707f; }

.cert-modern__eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #a8863c;
  margin-top: 22px;
}

.cert-modern__name {
  font-family: Lora, serif;
  font-size: 25px;
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.2;
}

.cert-modern__rows { margin-top: 18px; }

.cert-modern__row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-top: 1px solid rgba(28, 35, 51, .08);
  font-size: 12px;
  gap: 12px;
}

.cert-modern__row:last-child { border-bottom: 1px solid rgba(28, 35, 51, .08); }
.cert-modern__row span:first-child { color: #68707f; flex: none; }
.cert-modern__row span:last-child { font-weight: 600; text-align: right; }

.cert-modern__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 20px;
  gap: 12px;
}

.cert-modern__code {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #a8863c;
  margin-top: 8px;
}

.qr-box--round { border-radius: 6px; border-color: #1c2333; }

.cert-hybrid {
  margin-top: 12px;
  background: #fdfcf9;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  color: #26304a;
}

.cert-hybrid__bar { height: 6px; background: linear-gradient(90deg, #1e2d4f, #a8863c); }
.cert-hybrid__body { padding: 24px 22px; text-align: center; }

.cert-hybrid__lodge {
  font-family: Lora, serif;
  font-size: 16px;
  font-weight: 600;
}

.cert-hybrid__or {
  font-size: 10px;
  color: #7a7460;
  margin-top: 2px;
  letter-spacing: .5px;
}

.cert-hybrid__title {
  font-family: Lora, serif;
  font-size: 21px;
  color: #a8863c;
  margin-top: 18px;
}

.cert-hybrid__text {
  font-size: 12px;
  line-height: 1.7;
  margin-top: 12px;
  color: #3a4053;
  text-align: left;
}

.cert-hybrid__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 22px;
  gap: 12px;
}

.cert-hybrid__sign {
  text-align: left;
  width: 150px;
  border-top: 1px solid #26304a;
  padding-top: 5px;
}

.cert-hybrid__qrwrap { text-align: right; }

.qr-box--sm {
  width: 42px;
  height: 42px;
  border-radius: 5px;
  display: inline-flex;
}

.cert-hybrid__code {
  font-family: ui-monospace, monospace;
  font-size: 9.5px;
  margin-top: 4px;
}

.cert-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-wa {
  width: 100%;
  padding: 16px;
  border-radius: 13px;
  border: none;
  background: #1f9d55;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-wa:hover { filter: brightness(1.08); }

/* ---------- toast ---------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(86px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 50;
  background: #1c2333;
  color: #f7f6f3;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  white-space: nowrap;
  animation: fadeUp .2s ease;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark .toast { background: #2a3042; }

/* ---------- touch input sizing (must stay last) ----------
   iOS Safari auto-zooms the page when a focused field is under 16px, which
   throws the layout off. Bump every field to 16px on touch devices only, so
   the design's typography is preserved with a mouse. Kept at the end of the
   file so it wins the cascade over later per-field font-size rules. */
@media (pointer: coarse) {
  .input,
  .input--search,
  .input--inline,
  input,
  select,
  textarea { font-size: 16px; }
}
