/* ==================================================================
   Tema "Sessão" — kit de componentes compartilhados das páginas
   (conta, catálogo, comunidade, gamificação, assinaturas…).
   Usa somente as variáveis de theme.css, então funciona no claro e no escuro.
   Cada módulo pode ter um CSS próprio em assets/css/pages/{modulo}.css.
   ================================================================== */

/* ------------------------------ página ------------------------------ */
.page { padding: 28px 0 72px; }
/* .page vem depois de .wrap e zerava as margens laterais: o conteúdo encostava na borda da tela */
.wrap.page { padding-left: var(--gutter); padding-right: var(--gutter); }
.page--tight { padding-top: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 24px; }
.page-head-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: .95; letter-spacing: .005em; }
.page-head-sub { margin-top: 8px; color: var(--muted); max-width: 70ch; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 10px; padding: 0; font-size: .86rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); }
.section { margin-top: 36px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1; letter-spacing: .01em; }
.section-sub { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.text-soft { color: var(--text-soft); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------ grades ------------------------------ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stack { display: grid; gap: 12px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------ painéis ------------------------------ */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { margin-top: 20px; }
.grid > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 1.05rem; font-weight: 700; }
.panel-sub { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.panel-body { padding: 20px; }
.panel-body--flush { padding: 0; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }

/* ------------------------------ botões extras ------------------------------ */
.btn--secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--surface-3); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.06); }
.btn--danger-soft { background: var(--ui-danger-soft); color: var(--danger); }
.btn--success { background: var(--success); color: #fff; }
.btn--lg { min-height: 54px; padding: 0 28px; font-size: 1.02rem; border-radius: 14px; }
.btn--icon { width: 42px; padding: 0; }
.btn--sm.btn--icon { width: 38px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.is-active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn--ghost.is-loading::after, .btn--secondary.is-loading::after { border-color: var(--text); border-right-color: transparent; }
.btn-link { border: 0; background: none; padding: 0; color: var(--accent-text); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-link--muted { color: var(--muted); font-weight: 600; }
.btn-link--danger { color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* ------------------------------ formulários extras ------------------------------ */
.select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background-color: var(--ui-input-bg);
  color: var(--text);
  font: inherit;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A859C' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.select option { color: #1D1930; background: #fff; }
.select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.form-grid { display: grid; gap: 16px; }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.label .optional { font-weight: 500; color: var(--muted); font-size: .8rem; margin-left: 4px; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--ui-input-bg); overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group > span { display: grid; place-items: center; padding: 0 12px; color: var(--muted); background: var(--surface-2); font-size: .9rem; }
.input-group .input { border: 0; box-shadow: none !important; border-radius: 0; flex: 1; min-width: 0; }
.char-count { font-size: .78rem; color: var(--muted); text-align: right; }
.char-count.is-over { color: var(--danger); font-weight: 700; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { flex: none; width: 42px; height: 26px; border-radius: 13px; background: var(--border-strong); position: relative; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:disabled + .switch-track { opacity: .5; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text strong { display: block; font-size: .95rem; }
.switch-text small { display: block; font-size: .84rem; color: var(--muted); }

/* ------------------------------ selos e chips ------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-soft); }
.badge .icon { width: 13px; height: 13px; }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.badge--success { background: var(--ui-success-soft); color: var(--success); }
.badge--danger { background: var(--ui-danger-soft); color: var(--danger); }
.badge--warning { background: var(--ui-warning-soft); color: var(--warning); }
.badge--info { background: var(--ui-info-soft); color: var(--info); }
.badge--solid { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft); font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--text-soft); }
.chip.is-active, .chip[aria-current="page"], .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { opacity: .7; font-weight: 500; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips--scroll::-webkit-scrollbar { display: none; }

/* ------------------------------ abas ------------------------------ */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 22px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px 13px; color: var(--muted); font-weight: 700; font-size: .95rem; white-space: nowrap; text-decoration: none; border: 0; background: none; font-family: inherit; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.is-active, .tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--text); }
.tab.is-active::after, .tab[aria-current="page"]::after, .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--accent); }
.tab .count { font-size: .76rem; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-soft); }

/* ------------------------------ listas ------------------------------ */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item--link { text-decoration: none; color: inherit; }
.list-item--link:hover { background: var(--hover); }
.list-icon { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-soft); }
.list-icon .icon { width: 19px; height: 19px; }
.list-icon--accent { background: var(--accent-soft); color: var(--accent-text); }
.list-icon--success { background: var(--ui-success-soft); color: var(--success); }
.list-icon--danger { background: var(--ui-danger-soft); color: var(--danger); }
.list-icon--info { background: var(--ui-info-soft); color: var(--info); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; }
.list-sub { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.list-side { flex: none; text-align: right; display: grid; gap: 4px; justify-items: end; }
.list-amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.list-amount--plus { color: var(--success); }
.list-amount--minus { color: var(--danger); }

/* ------------------------------ tabelas ------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-actions { text-align: right; white-space: nowrap; width: 1%; }
@media (max-width: 720px) {
  .table--responsive thead { display: none; }
  .table--responsive tr { display: block; padding: 10px 16px; border-bottom: 1px solid var(--border); }
  .table--responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
  .table--responsive td::before { content: attr(data-label); color: var(--muted); font-weight: 600; text-align: left; }
  .table--responsive td.col-main { display: block; text-align: left; }
  .table--responsive td.col-main::before { display: none; }
}

/* ------------------------------ estado vazio, avisos ------------------------------ */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft); font-size: .94rem; }
.callout > .icon { margin-top: 2px; flex: none; }
.callout strong { display: block; color: var(--text); }
.callout--info { background: var(--ui-info-soft); border-color: transparent; }
.callout--info > .icon { color: var(--info); }
.callout--success { background: var(--ui-success-soft); border-color: transparent; }
.callout--success > .icon { color: var(--success); }
.callout--warning { background: var(--ui-warning-soft); border-color: transparent; }
.callout--warning > .icon { color: var(--warning); }
.callout--danger { background: var(--ui-danger-soft); border-color: transparent; }
.callout--danger > .icon { color: var(--danger); }
.callout--accent { background: var(--accent-soft); border-color: transparent; }
.callout--accent > .icon { color: var(--accent-text); }

/* ------------------------------ avatar ------------------------------ */
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: .9rem; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 24px; height: 24px; font-size: .64rem; }
.avatar--sm { width: 32px; height: 32px; font-size: .76rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar--xl { width: 96px; height: 96px; font-size: 1.9rem; }
.avatar-online { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 9px; min-height: 9px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.user-line { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.user-line-text { display: grid; min-width: 0; }
.user-line-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-line-sub { font-size: .82rem; color: var(--muted); }

/* ------------------------------ progresso e números ------------------------------ */
.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.progress--sm { height: 6px; }
.progress--success > i { background: var(--success); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-card { padding: 16px 18px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); display: grid; gap: 4px; }
.stat-card-label { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); font-weight: 600; }
.stat-card-label .icon { width: 16px; height: 16px; }
.stat-card-value { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card-note { font-size: .8rem; color: var(--muted); }
.stat-card--accent { background: radial-gradient(120% 140% at 0% 0%, var(--accent-soft), transparent 60%), var(--surface); }
.detail-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: .94rem; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------ paginação ------------------------------ */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; color: var(--muted); font-size: .9rem; }
.pagination { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pagination a, .pagination span { min-width: 40px; height: 40px; padding: 0 10px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.pagination a:hover { background: var(--surface-2); }
.pagination .is-current { background: var(--text); color: var(--bg); border-color: var(--text); }
.pagination .is-gap { border: 0; background: transparent; }

/* ------------------------------ barra de ferramentas ------------------------------ */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .select { width: auto; min-height: 40px; padding-top: 8px; padding-bottom: 8px; font-size: .9rem; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.segmented a, .segmented button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.segmented .is-active, .segmented [aria-current="page"] { background: var(--surface-3); color: var(--text); }

/* ------------------------------ grade de pôsteres (listagens) ------------------------------ */
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
.poster-grid--wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.poster-grid .card { scroll-snap-align: none; }

/* ------------------------------ menu suspenso genérico ------------------------------ */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 200px; padding: 6px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--ui-shadow-lg); display: none; }
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu--left { right: auto; left: 0; }
.dropdown-item, .dropdown-menu form button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: .92rem; text-align: left; text-decoration: none; cursor: pointer; }
.dropdown-item:hover, .dropdown-menu form button:hover { background: var(--hover); }
.dropdown-item .icon, .dropdown-menu form button .icon { width: 17px; height: 17px; color: var(--muted); }
.dropdown-item.is-danger, .dropdown-menu form button.is-danger { color: var(--danger); }
.dropdown-item.is-danger .icon, .dropdown-menu form button.is-danger .icon { color: var(--danger); }
.dropdown-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* ------------------------------ estrelas (avaliação) ------------------------------ */
.stars { display: inline-flex; gap: 2px; color: var(--accent); }
.stars .icon { width: 16px; height: 16px; }
.stars .is-off { color: var(--border-strong); }

/* ------------------------------ carregamento ------------------------------ */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: skeleton 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes skeleton { to { background-position: -200% 0; } }

/* ------------------------------ área "Minha conta" ------------------------------ */
.account-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; padding-top: 28px; padding-bottom: 72px; align-items: start; }
.account-nav { position: sticky; top: calc(var(--header-height) + 16px); display: grid; gap: 18px; }
.account-user { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.account-user strong { display: block; line-height: 1.2; }
.account-user span { font-size: .84rem; color: var(--muted); }
.account-nav-section p { margin: 0 0 6px 10px; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: 0; }
.account-nav-section ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.account-nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; color: var(--text-soft); text-decoration: none; font-weight: 600; font-size: .94rem; }
.account-nav a:hover { background: var(--hover); color: var(--text); }
.account-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.account-nav a .icon { width: 18px; height: 18px; }
.account-main { min-width: 0; }
.account-main > .page-head { margin-top: 0; }

/* ------------------------------ responsivo ------------------------------ */
@media (max-width: 1000px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-shell { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 16px; }
  .account-nav { position: static; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px; }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-user { display: none; }
  .account-nav-section { display: contents; }
  .account-nav-section p { display: none; }
  .account-nav-section ul { display: contents; }
  .account-nav a { flex: none; min-height: 38px; border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; font-size: .88rem; white-space: nowrap; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .form-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .page { padding-top: 18px; }
  .panel-head, .panel-body, .panel-foot { padding-left: 16px; padding-right: 16px; }
  .list-item { padding: 12px 16px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 16px 10px; }
  .detail-list { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .detail-list dd { margin-bottom: 8px; }
  .page-head-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .progress > i { transition: none; }
}

/* Aviso de incidente (modo somente leitura ou interruptor de emergência) */
.incident-banner { position: relative; z-index: 40; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; background: var(--warning); color: #fff; font-size: 14px; font-weight: 600; line-height: 1.4; text-align: center; }
.incident-banner svg { flex: none; width: 18px; height: 18px; }

/* Erro de validação por campo (componente field-error) */
.field-error { display: block; margin-top: 6px; color: var(--danger, #e03131); font-size: .82rem; }

/* Rede de segurança no celular: nada alarga a página (evita o "zoom para afastar") */
html, body { max-width: 100%; overflow-x: clip; }
:where(.wrap, [class$="-page"], [class*="-page "]) > * { min-width: 0; }
:where(main img, main video, main canvas, main svg) { max-width: 100%; }

/* Formulários de busca nunca passam da largura do cartão (celular) */
form[role="search"] { min-width: 0; max-width: 100%; box-sizing: border-box; }
form[role="search"] input[type="search"], form[role="search"] input[type="text"] { min-width: 0; }
