/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .925rem/1 var(--font); padding: 10px 16px; min-height: 40px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--primary); color: var(--on-primary); cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.btn-soft:hover { background: var(--primary-soft-2); }
.btn-brass { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #2a1a00; font-size: 1rem; padding: 12px 22px; min-height: 46px; }
.btn-brass:hover { background: linear-gradient(135deg, #fcd34d, #fbbf24); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: .85rem; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--primary); cursor: pointer; text-underline-offset: 3px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Escolhas ---------- */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { font: 500 .875rem var(--font); background: none; border: 0; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.segmented-sm button { padding: 3px 10px; font-size: .8rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: 500 .875rem var(--font); padding: 6px 12px;
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-count { font-size: .75rem; opacity: .8; font-variant-numeric: tabular-nums; }

/* ---------- Mensagens ---------- */
.error { color: var(--danger); font-weight: 500; font-size: .9rem; }
.notice { background: var(--warning-soft); color: var(--text); border-radius: var(--r-md); padding: 12px 16px; display: grid; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; padding: 2px 8px;
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.tag svg { width: 12px; height: 12px; }
.tag-ok { background: var(--success-soft); color: var(--success); }
.tag-primary { background: var(--primary-soft); color: var(--primary); }
.role-pill { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; background: var(--primary); color: var(--on-primary); border-radius: var(--r-pill); font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 7px; font: 600 .9rem var(--font); background: none; border: 0;
  padding: 10px 12px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button svg { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Listas e cartões ---------- */
.card-surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.list { list-style: none; margin: 0; padding: 4px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 18px; flex-wrap: wrap; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.item-line { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; min-width: 0; }
.item-line > span { display: grid; min-width: 0; }
.item-line strong { font-weight: 600; }
.cover { display: block; object-fit: cover; background: var(--surface-2); border-radius: 6px; flex: none; }
.cover-sm { width: 40px; height: 54px; }
.cover-md { width: 56px; height: 76px; border-radius: var(--r-sm); }
.cover-lg { width: 132px; height: 180px; border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.cover-blank { display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: var(--primary); background: linear-gradient(145deg, var(--primary-soft), var(--primary-soft-2)); }
.cover-lg.cover-blank { font-size: 2.4rem; }
.empty { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 36px 28px; display: grid; gap: 10px; justify-items: center; text-align: center; color: var(--text-2); }
.empty-icon { width: 48px; height: 48px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-icon svg { width: 24px; height: 24px; }
.empty-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--text); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Estrelas ---------- */
.stars { display: inline-flex; gap: 1px; line-height: 1; vertical-align: -2px; }
.star { position: relative; color: var(--border-strong); }
.star::after { content: '★'; position: absolute; left: 0; top: 0; color: var(--star); width: var(--fill); overflow: hidden; }
.stars-sm { font-size: .95rem; }
.stars-md { font-size: 1.2rem; }
.stars-lg { font-size: 1.6rem; }
.star-input { display: flex; align-items: center; gap: 2px; }
.star-input button { background: none; border: 0; font-size: 2rem; line-height: 1; color: var(--border-strong); cursor: pointer; padding: 0 2px; transition: transform .1s, color .1s; }
.star-input button:hover { transform: scale(1.12); }
.star-input button.on { color: var(--star); }
.star-input .muted { margin-left: 10px; }

/* ---------- Modal ---------- */
.modal {
  border: 1px solid var(--border); padding: 0; border-radius: var(--r-lg);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal-wide { width: min(720px, calc(100vw - 24px)); }
.modal::backdrop { background: rgb(10 8 24 / 55%); backdrop-filter: blur(3px); }
.modal-body { padding: 20px 24px 24px; display: grid; gap: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 1.15rem; }
@media (prefers-reduced-motion: no-preference) {
  .modal[open] { animation: modal-in .18s ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
}

/* ---------- Avatares ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: var(--surface-2); }
.avatar-blank { color: #fff; font-family: var(--font); font-weight: 700; letter-spacing: .01em; user-select: none; }
.avatar-xs { width: 22px; height: 22px; font-size: .6rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-md { width: 42px; height: 42px; font-size: .9rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.3rem; }
.handle { color: var(--text-2); font-weight: 400; }
/* Bolinha de presença no canto do avatar */
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.status-dot {
  --dot: 10px; position: absolute; right: -1px; bottom: -1px; width: var(--dot); height: var(--dot); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--dot-ring, var(--surface)); background: var(--status-offline);
}
.status-dot.is-inline { position: static; display: inline-block; box-shadow: none; --dot: 9px; flex: none; }
.avatar-wrap-xs .status-dot { --dot: 8px; right: -2px; bottom: -2px; }
.avatar-wrap-md .status-dot { --dot: 12px; right: 0; bottom: 0; }
.avatar-wrap-lg .status-dot { --dot: 16px; right: 3px; bottom: 3px; }
.avatar-wrap-xl .status-dot { --dot: 22px; right: 8px; bottom: 8px; box-shadow: 0 0 0 4px var(--dot-ring, var(--surface)); }
.status-online { background: var(--status-online); }
.status-busy { background: var(--status-busy); }
.status-away { background: var(--status-away); }
/* Ocupado: tracinho branco, para não depender só da cor */
.status-busy::after { content: ''; position: absolute; inset: 42% 22%; border-radius: 2px; background: #fff; }
.status-dot.is-inline.status-busy { position: relative; }
/* Offline: anel vazado */
.status-offline { background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--status-offline), 0 0 0 2px var(--dot-ring, var(--surface)); }
.status-dot.is-inline.status-offline { box-shadow: inset 0 0 0 2px var(--status-offline); }
.person-status { font-size: .82rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { display: grid; line-height: 1.3; min-width: 0; }
.person-text strong, .person-text .handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-more { display: flex; justify-content: center; padding: 8px 0; }

/* ---------- Toasts ---------- */
.toaster {
  position: fixed; z-index: 1000; right: 20px; bottom: 20px; display: grid; gap: 10px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 12px 12px 12px 14px; border-radius: var(--r-md); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .9rem; position: relative; overflow: hidden;
}
.toast-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.toast-icon svg { width: 15px; height: 15px; }
.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-info .toast-icon { background: var(--primary-soft); color: var(--primary); }
.toast-text { padding-top: 3px; display: grid; gap: 2px; }
.toast-text strong { font-weight: 600; }
.toast .icon-btn { width: 28px; height: 28px; margin: -2px -2px 0 0; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .25; animation: toast-bar linear forwards; }
.toast-success .toast-bar { color: var(--success); }
.toast-error .toast-bar { color: var(--danger); }
.toast-info .toast-bar { color: var(--primary); }
@keyframes toast-bar { from { width: 100%; } to { width: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .22s cubic-bezier(.2,.9,.3,1.2); }
  .toast.is-leaving { animation: toast-out .16s ease-in forwards; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
  @keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
}
@media (max-width: 760px) {
  .toaster { right: 16px; left: 16px; bottom: auto; top: 12px; width: auto; }
}

/* Link "Como funciona?" espalhado pelas telas */
.help-link { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; font-weight: 500; color: var(--text-2); text-decoration: none; }
.help-link svg { width: 15px; height: 15px; }
.help-link:hover { color: var(--primary); }


/* Moderação vendo um clube de que não participa */
.staff-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: var(--r-md); font-size: .9rem; color: var(--text); background: color-mix(in srgb, #0e7490 10%, var(--surface)); border: 1px solid color-mix(in srgb, #0e7490 30%, var(--border)); }
.staff-note svg { width: 18px; height: 18px; flex: none; color: #0e7490; margin-top: 1px; }
[data-theme='dark'] .staff-note svg { color: #67e8f9; }
.role-pill.is-staff { background: color-mix(in srgb, #0e7490 14%, transparent); color: #0e7490; }
[data-theme='dark'] .role-pill.is-staff { color: #67e8f9; }

/* Recorte de foto (avatar) */
.crop { display: grid; gap: 14px; }
.crop-stage {
  position: relative; width: min(340px, 100%); aspect-ratio: 1; margin: 0 auto; overflow: hidden;
  border-radius: var(--r-md); background: var(--surface-3); touch-action: none; user-select: none; cursor: grab; outline: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage:focus-visible { box-shadow: var(--ring); }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-mask {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 999px rgb(10 8 24 / 55%); outline: 2px solid rgb(255 255 255 / 90%); outline-offset: -2px;
}
.crop-stage.is-loading .crop-mask { box-shadow: none; outline-color: var(--border-strong); }
.crop-wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); font-size: .875rem; }
.crop-tools { display: flex; align-items: center; justify-content: center; gap: 6px; }
.crop-tools input[type='range'] { flex: 1; max-width: 220px; accent-color: var(--primary); }
.crop-tools .icon-btn svg { width: 18px; height: 18px; }
