/*==============================================================================
  AgendaZ — shell da aplicacao

  Sidebar, topbar e area de conteudo. Substitui por completo o layout do
  template antigo (.layout-wrapper / .layout-menu / .layout-navbar), por isso
  nao existe sobreposicao de classes entre os dois: o shell novo vive inteiro
  no namespace `w-`.

  Em telas menores que 992px a sidebar vira gaveta sobre um scrim, e o grid
  passa a uma coluna — nao ha nenhum ponto do sistema que role na horizontal.
==============================================================================*/

:root {
    --w-topbar-height: 58px;
    --w-sidebar-width: 262px;
    --w-sidebar-collapsed: 68px;
}

/*==============================================================================
  Estrutura
==============================================================================*/

/*
 * Quem rola e a area de conteudo, nao a pagina.
 *
 * Assim a sidebar e a barra superior ficam sempre no lugar e a cor da sidebar
 * cobre a altura inteira da tela em qualquer ponto da rolagem. A alternativa
 * (pagina rolando com a sidebar em `position: sticky`) depende de nenhum
 * ancestral criar contexto de rolagem — e basta um `overflow` em qualquer lugar
 * para a sidebar voltar a subir junto com o conteudo, deixando uma faixa vazia
 * embaixo.
 */
.w-shell {
    display: grid;
    grid-template-columns: var(--w-sidebar-width) 1fr;
    grid-template-rows: var(--w-topbar-height) 1fr;
    grid-template-areas:
        'sidebar topbar'
        'sidebar main';
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--w-canvas);
    transition: grid-template-columns var(--w-duration-normal) var(--w-ease-out);
}

.w-shell[data-sidebar='collapsed'] { grid-template-columns: var(--w-sidebar-collapsed) 1fr; }

/*==============================================================================
  Sidebar
==============================================================================*/

.w-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    background: var(--w-sidebar-solid);
    color: var(--w-sidebar-fg);
    z-index: var(--w-z-sidebar);
    overflow: hidden;
    height: 100%;
}

.w-sidebar__top {
    display: flex;
    align-items: center;
    gap: var(--w-space-3);
    height: var(--w-topbar-height);
    padding: 0 var(--w-space-4);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.w-sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--w-space-2);
    color: var(--w-sidebar-fg-strong);
    font-size: var(--w-text-xl);
    font-weight: var(--w-weight-bold);
    letter-spacing: -0.02em;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.w-sidebar__brand:hover { color: var(--w-sidebar-fg-strong); }

.w-sidebar__mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: var(--w-radius-md);
    background: var(--w-brand-500);
    color: #fff;
    font-size: var(--w-text-md);
    font-weight: var(--w-weight-bold);
}

.w-sidebar__collapse {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: auto;
    flex: none;
    border: 0;
    border-radius: var(--w-radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--w-sidebar-fg);
    cursor: pointer;
    transition: background-color var(--w-duration-fast) var(--w-ease-out),
                transform var(--w-duration-fast) var(--w-ease-out);
}

.w-sidebar__collapse:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.w-sidebar__collapse svg { width: 16px; height: 16px; transition: transform var(--w-duration-normal) var(--w-ease-out); }
.w-shell[data-sidebar='collapsed'] .w-sidebar__collapse svg { transform: rotate(180deg); }

.w-menu {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: var(--w-space-3) var(--w-space-3) var(--w-space-6);
    overflow-y: auto;
    overflow-x: hidden;
}

.w-menu::-webkit-scrollbar { width: 6px; }
.w-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: var(--w-radius-full); }

.w-menu__section {
    padding: var(--w-space-5) var(--w-space-3) var(--w-space-2);
    font-size: var(--w-text-2xs);
    font-weight: var(--w-weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.w-menu__item,
.w-menu__group { list-style: none; position: relative; }
.w-menu__item form { margin: 0; }

.w-menu__row {
    display: flex;
    align-items: center;
    gap: var(--w-space-3);
    width: 100%;
    padding: 9px var(--w-space-3);
    border: 0;
    border-radius: var(--w-radius-md);
    background: transparent;
    color: var(--w-sidebar-fg);
    font-family: var(--w-font-sans);
    font-size: var(--w-text-base);
    font-weight: var(--w-weight-medium);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--w-duration-fast) var(--w-ease-out),
                color var(--w-duration-fast) var(--w-ease-out);
}

.w-menu__row:hover { background: var(--w-sidebar-hover); color: var(--w-sidebar-fg-strong); }

.w-menu__item > .w-menu__row.is-active {
    background: var(--w-sidebar-active-bg);
    color: var(--w-sidebar-active-fg);
    font-weight: var(--w-weight-semibold);
}

.w-menu__group > .w-menu__row.is-active { background: transparent; color: var(--w-sidebar-fg-strong); }

.w-menu__icon { width: 20px; height: 20px; flex: none; stroke-width: 1.75; }
.w-menu__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.w-menu__chevron {
    width: 15px;
    height: 15px;
    flex: none;
    opacity: 0.7;
    transition: transform var(--w-duration-fast) var(--w-ease-out);
}

.w-menu__group.is-open > .w-menu__row .w-menu__chevron { transform: rotate(180deg); }

.w-menu__sub {
    display: none;
    list-style: none;
    margin: 2px 0 var(--w-space-2);
    padding: 0 0 0 calc(20px + var(--w-space-3) + var(--w-space-3));
}

.w-menu__group.is-open > .w-menu__sub { display: block; }

.w-menu__sub .w-menu__row {
    padding: 7px var(--w-space-3);
    font-size: var(--w-text-sm);
    font-weight: var(--w-weight-normal);
    color: var(--w-sidebar-child-fg);
}

.w-menu__sub .w-menu__row::before {
    content: '';
    width: 5px;
    height: 5px;
    flex: none;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
}

.w-menu__sub .w-menu__row:hover { color: var(--w-sidebar-fg-strong); background: var(--w-sidebar-hover); }

.w-menu__sub .w-menu__row.is-active {
    color: var(--w-sidebar-fg-strong);
    font-weight: var(--w-weight-medium);
    background: var(--w-sidebar-hover);
}

.w-menu__sub .w-menu__row.is-active::before { opacity: 1; background: var(--w-brand-400); }

/*==============================================================================
  Sidebar recolhida

  Recolhida a sidebar mostra so os icones. Duas decisoes sustentam isso:

  1. O rotulo nao desaparece, vira um balao ao lado do icone no hover. Um menu
     so de icones obriga a decorar o que cada desenho significa; com o balao a
     forma curta continua legivel.

  2. O topo alterna entre a marca e o botao de expandir no mesmo espaco. Os dois
     lado a lado nao cabem em 68px, e esconder o botao deixaria a pessoa presa
     no estado recolhido.
==============================================================================*/

.w-shell[data-sidebar='collapsed'] .w-sidebar__brand span:not(.w-sidebar__mark),
.w-shell[data-sidebar='collapsed'] .w-menu__chevron,
.w-shell[data-sidebar='collapsed'] .w-menu__section { display: none; }

/* Sem recorte: os baloes e submenus saem para fora da coluna. */
.w-shell[data-sidebar='collapsed'] .w-sidebar,
.w-shell[data-sidebar='collapsed'] .w-menu { overflow: visible; }

.w-shell[data-sidebar='collapsed'] .w-menu { padding-inline: var(--w-space-2); }
.w-shell[data-sidebar='collapsed'] .w-menu__row { justify-content: center; padding-inline: 0; gap: 0; }

/*--- Topo: marca e botao ocupam o mesmo lugar ------------------------------*/

.w-shell[data-sidebar='collapsed'] .w-sidebar__top {
    position: relative;
    justify-content: center;
    padding: 0;
}

.w-shell[data-sidebar='collapsed'] .w-sidebar__brand {
    transition: opacity var(--w-duration-fast) var(--w-ease-out);
}

.w-shell[data-sidebar='collapsed'] .w-sidebar__collapse {
    position: absolute;
    inset: 0;
    width: 32px;
    height: 32px;
    margin: auto;
    opacity: 0;
    transition: opacity var(--w-duration-fast) var(--w-ease-out);
}

.w-shell[data-sidebar='collapsed'] .w-sidebar__top:hover .w-sidebar__brand,
.w-shell[data-sidebar='collapsed'] .w-sidebar__top:focus-within .w-sidebar__brand { opacity: 0; }

.w-shell[data-sidebar='collapsed'] .w-sidebar__top:hover .w-sidebar__collapse,
.w-shell[data-sidebar='collapsed'] .w-sidebar__top:focus-within .w-sidebar__collapse { opacity: 1; }

/*--- Rotulo vira balao ao lado do icone ------------------------------------*/

.w-shell[data-sidebar='collapsed'] .w-menu > .w-menu__item > .w-menu__row .w-menu__label {
    display: none;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: var(--w-space-2);
    padding: var(--w-space-2) var(--w-space-3);
    border-radius: var(--w-radius-md);
    background: var(--w-sidebar-solid);
    box-shadow: var(--w-shadow-lg);
    color: var(--w-sidebar-fg-strong);
    font-size: var(--w-text-sm);
    font-weight: var(--w-weight-medium);
    white-space: nowrap;
    pointer-events: none;
    z-index: var(--w-z-dropdown);
}

.w-shell[data-sidebar='collapsed'] .w-menu > .w-menu__item > .w-menu__row:hover .w-menu__label,
.w-shell[data-sidebar='collapsed'] .w-menu > .w-menu__item > .w-menu__row:focus-visible .w-menu__label { display: block; }

/*--- Submenu vira painel flutuante ----------------------------------------*/

.w-shell[data-sidebar='collapsed'] .w-menu > .w-menu__group > .w-menu__row .w-menu__label { display: none; }

.w-shell[data-sidebar='collapsed'] .w-menu__sub {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 216px;
    margin: 0;
    padding: var(--w-space-2);
    border-radius: var(--w-radius-lg);
    background: var(--w-sidebar-solid);
    box-shadow: var(--w-shadow-lg);
    z-index: var(--w-z-dropdown);
}

/* Faixa invisivel entre o icone e o painel: sem ela o painel fecha quando o
   ponteiro atravessa o vao. */
.w-shell[data-sidebar='collapsed'] .w-menu__sub::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 8px;
    height: 100%;
}

.w-shell[data-sidebar='collapsed'] .w-menu__group:hover > .w-menu__sub,
.w-shell[data-sidebar='collapsed'] .w-menu__group:focus-within > .w-menu__sub { display: block; }

.w-shell[data-sidebar='collapsed'] .w-menu__sub .w-menu__row { justify-content: flex-start; padding-inline: var(--w-space-3); gap: var(--w-space-2); }

.w-shell[data-sidebar='collapsed'] .w-menu__sub .w-menu__row::before { display: none; }

.w-shell[data-sidebar='collapsed'] .w-menu__sub .w-menu__label {
    display: block;
    position: static;
    transform: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-size: var(--w-text-sm);
    font-weight: inherit;
}

/* Grupo com pagina ativa: sem o rotulo, o unico sinal possivel e o icone. */
.w-shell[data-sidebar='collapsed'] .w-menu__group > .w-menu__row.is-active {
    background: var(--w-sidebar-hover);
    color: var(--w-sidebar-fg-strong);
}

/*==============================================================================
  Topbar
==============================================================================*/

.w-topbar {
    grid-area: topbar;
    z-index: var(--w-z-topbar);
    display: flex;
    align-items: center;
    gap: var(--w-space-3);
    height: var(--w-topbar-height);
    padding: 0 var(--w-space-5);
    background: var(--w-topbar-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--w-border);
}

.w-topbar__spacer { flex: 1; }

.w-topbar__toggle {
    display: none;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 0;
    border-radius: var(--w-radius-md);
    background: transparent;
    color: var(--w-text-secondary);
    cursor: pointer;
}

.w-topbar__toggle:hover { background: var(--w-surface-hover); color: var(--w-text-primary); }
.w-topbar__toggle svg { width: 20px; height: 20px; }

.w-topbar__meta {
    display: flex;
    align-items: center;
    gap: var(--w-space-2);
    min-width: 0;
    color: var(--w-text-secondary);
    font-size: var(--w-text-sm);
}

.w-topbar__meta strong { color: var(--w-text-primary); font-weight: var(--w-weight-semibold); }
.w-topbar__meta svg { width: 15px; height: 15px; flex: none; }

.w-topbar__action {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 1px solid transparent;
    border-radius: var(--w-radius-md);
    background: transparent;
    color: var(--w-text-secondary);
    cursor: pointer;
    transition: background-color var(--w-duration-fast) var(--w-ease-out),
                color var(--w-duration-fast) var(--w-ease-out);
}

.w-topbar__action:hover { background: var(--w-surface-hover); color: var(--w-text-primary); }
.w-topbar__action svg { width: 18px; height: 18px; }
.w-topbar__action i { font-size: 18px; line-height: 1; }

.w-topbar__timer {
    display: inline-flex;
    align-items: center;
    gap: var(--w-space-2);
    padding: 0 var(--w-space-3);
    height: 30px;
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius-full);
    background: var(--w-surface-sunken);
    color: var(--w-text-secondary);
    font-family: var(--w-font-mono);
    font-size: var(--w-text-xs);
    font-variant-numeric: tabular-nums;
}

.w-topbar__timer svg { width: 14px; height: 14px; }

/* Identidade do usuario + menu */
.w-user {
    display: flex;
    align-items: center;
    gap: var(--w-space-2);
    padding: var(--w-space-1) var(--w-space-2);
    border: 0;
    border-radius: var(--w-radius-md);
    background: transparent;
    color: inherit;
    cursor: pointer;
    max-width: 220px;
}

.w-user:hover { background: var(--w-surface-hover); }

.w-user__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    background: var(--w-accent);
    color: #fff;
    font-size: var(--w-text-sm);
    font-weight: var(--w-weight-semibold);
    text-transform: uppercase;
}

.w-user__info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; text-align: left; }
.w-user__name { color: var(--w-text-primary); font-size: var(--w-text-sm); font-weight: var(--w-weight-semibold); }
.w-user__mail { color: var(--w-text-tertiary); font-size: var(--w-text-2xs); }
.w-user__name, .w-user__mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/*==============================================================================
  Area de conteudo
==============================================================================*/

.w-main {
    grid-area: main;
    min-width: 0;
    /* O unico elemento que rola. */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background: var(--w-canvas);
}

.w-page {
    width: 100%;
    max-width: var(--w-content-max);
    margin: 0 auto;
    padding: var(--w-space-6);
}

.w-page__header {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--w-space-3);
    margin-bottom: var(--w-space-5);
}

.w-page__heading { min-width: 0; flex: 1; }

.w-page__title {
    font-size: var(--w-text-2xl);
    font-weight: var(--w-weight-bold);
    letter-spacing: -0.02em;
    margin: 0;
}

.w-page__subtitle { color: var(--w-text-secondary); font-size: var(--w-text-sm); margin: var(--w-space-1) 0 0; }
.w-page__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--w-space-2); }

.w-footer {
    padding: var(--w-space-5) var(--w-space-6);
    border-top: 1px solid var(--w-border);
    color: var(--w-text-tertiary);
    font-size: var(--w-text-xs);
    text-align: center;
}

.w-footer a { color: var(--w-text-secondary); }

/*==============================================================================
  Toasts
==============================================================================*/

.w-toast-region {
    position: fixed;
    right: var(--w-space-5);
    bottom: var(--w-space-5);
    z-index: var(--w-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--w-space-2);
    pointer-events: none;
}

.w-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--w-space-3);
    min-width: 320px;
    max-width: 420px;
    padding: var(--w-space-4);
    border: 1px solid var(--w-border);
    border-left: 3px solid var(--w-toast-color, var(--w-info));
    border-radius: var(--w-radius-lg);
    background: var(--w-surface-overlay);
    box-shadow: var(--w-shadow-lg);
    color: var(--w-text-primary);
    pointer-events: auto;
    animation: w-toast-in var(--w-duration-normal) var(--w-ease-out);
}

.w-toast--success { --w-toast-color: var(--w-success); }
.w-toast--warning { --w-toast-color: var(--w-warning); }
.w-toast--danger  { --w-toast-color: var(--w-danger); }
.w-toast--info    { --w-toast-color: var(--w-info); }

.w-toast__icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--w-toast-color); }
.w-toast__body { flex: 1; min-width: 0; }
.w-toast__title { font-size: var(--w-text-base); font-weight: var(--w-weight-semibold); }
.w-toast__text { color: var(--w-text-secondary); font-size: var(--w-text-sm); margin-top: 2px; word-break: break-word; }

.w-toast__close {
    flex: none;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--w-radius-sm);
    background: transparent;
    color: var(--w-text-tertiary);
    cursor: pointer;
}

.w-toast__close:hover { background: var(--w-surface-hover); color: var(--w-text-primary); }
.w-toast__close svg { width: 14px; height: 14px; }
.w-toast.is-leaving { animation: w-toast-out var(--w-duration-fast) var(--w-ease-in-out) forwards; }

@keyframes w-toast-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes w-toast-out {
    to { opacity: 0; transform: translateX(20px); }
}

/*==============================================================================
  Confirmacao de exclusao
==============================================================================*/

.w-confirm__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto var(--w-space-4);
    border-radius: 50%;
    background: var(--w-danger-bg);
    color: var(--w-danger);
}

.w-confirm__icon svg { width: 24px; height: 24px; }
.w-confirm__subject { font-weight: var(--w-weight-semibold); color: var(--w-text-primary); margin-top: var(--w-space-2); }

/*==============================================================================
  Responsivo

  < 992px: a sidebar vira gaveta. O grid perde a coluna fixa, entao nada de
  conteudo fica escondido atras dela.
==============================================================================*/

@media (max-width: 991.98px) {
    .w-shell,
    .w-shell[data-sidebar='collapsed'] {
        grid-template-columns: 1fr;
        grid-template-areas: 'topbar' 'main';
    }

    .w-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(var(--w-sidebar-width), 86vw);
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform var(--w-duration-normal) var(--w-ease-out);
        box-shadow: var(--w-shadow-xl);
    }

    .w-shell[data-sidebar='open'] .w-sidebar { transform: translateX(0); }

    /* Na gaveta o menu volta ao formato completo, mesmo que estivesse recolhido
       no desktop. */
    .w-shell[data-sidebar='collapsed'] .w-menu__label,
    .w-shell[data-sidebar='collapsed'] .w-menu__chevron,
    .w-shell[data-sidebar='collapsed'] .w-menu__section { display: revert; }
    .w-shell[data-sidebar='collapsed'] .w-menu__row { justify-content: flex-start; padding-inline: var(--w-space-3); }
    .w-shell[data-sidebar='collapsed'] .w-menu__sub { position: static; box-shadow: none; min-width: 0; }

    .w-sidebar-scrim {
        position: fixed;
        inset: 0;
        z-index: calc(var(--w-z-sidebar) - 1);
        background: rgba(9, 12, 20, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--w-duration-normal) var(--w-ease-out),
                    visibility var(--w-duration-normal);
    }

    .w-shell[data-sidebar='open'] .w-sidebar-scrim { opacity: 1; visibility: visible; }

    .w-topbar__toggle { display: grid; }
    .w-sidebar__collapse { display: none; }
    .w-page { padding: var(--w-space-4); }
    .w-topbar { padding-inline: var(--w-space-4); }
}

@media (min-width: 992px) {
    .w-sidebar-scrim { display: none; }
}

@media (max-width: 767.98px) {
    .w-topbar__meta,
    .w-topbar__timer { display: none; }

    .w-user__info { display: none; }
    .w-user { max-width: none; padding: 0; }
    .w-page__title { font-size: var(--w-text-xl); }

    /* Barras de acao empilham em vez de espremer os botoes. */
    .w-page__header { flex-direction: column; align-items: stretch; }
    .w-page__actions .btn { flex: 1; }
}

@media (max-width: 575.98px) {
    .w-page { padding: var(--w-space-3); }
    .w-toast-region { left: var(--w-space-3); right: var(--w-space-3); bottom: var(--w-space-3); }
    .w-toast { min-width: 0; max-width: none; }
    .card-body { padding: var(--w-space-4); }
    .modal-header, .modal-body { padding: var(--w-space-4); }
    .modal-footer { padding: var(--w-space-3) var(--w-space-4); }

    /* Empilha grupos de botoes que ficariam menores que o alvo de toque. */
    .w-page__actions { width: 100%; }
    .w-page__actions .btn { width: 100%; }
}

/* Impressao: sem chrome, so o conteudo. */
@media print {
    .w-sidebar, .w-topbar, .w-footer, .w-toast-region, .w-sidebar-scrim { display: none !important; }
    .w-shell { display: block; height: auto; overflow: visible; }
    .w-main { overflow: visible; }
    .w-page { padding: 0; max-width: none; }
}

/*==============================================================================
  Telas de conta (entrar, cadastrar, recuperar senha)

  Duas colunas no desktop: marca a esquerda, formulario a direita. No celular a
  coluna da marca sai de cena — numa tela estreita ela empurraria o formulario
  para baixo da dobra, e a primeira coisa que a pessoa precisa ver e o campo de
  e-mail.
==============================================================================*/

.w-auth-body {
    margin: 0;
    background: var(--w-canvas);
}

.w-auth {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

.w-auth__brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--w-space-12);
    overflow: hidden;
    background:
        radial-gradient(1200px 600px at 20% 10%, rgba(255, 255, 255, 0.14), transparent 60%),
        linear-gradient(140deg, var(--w-brand-900) 0%, var(--w-brand-700) 45%, var(--w-brand-500) 100%);
    color: #fff;
}

/* Malha sutil, para o painel nao ficar um bloco chapado de cor. */
.w-auth__brand::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 30% 30%, #000, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 30% 30%, #000, transparent 70%);
    pointer-events: none;
}

.w-auth__brand-inner { position: relative; z-index: 1; max-width: 460px; }

.w-auth__logo {
    display: inline-block;
    font-size: clamp(2.25rem, 4vw, 3rem);
    font-weight: var(--w-weight-bold);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #fff;
}

.w-auth__logo:hover { color: #fff; }
.w-auth__logo-accent { color: var(--w-emerald-400); }

.w-auth__pitch {
    margin: var(--w-space-4) 0 var(--w-space-8);
    font-size: var(--w-text-lg);
    line-height: var(--w-leading-relaxed);
    color: rgba(255, 255, 255, 0.82);
}

.w-auth__points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--w-space-3); }

.w-auth__points li {
    display: flex;
    align-items: center;
    gap: var(--w-space-3);
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--w-text-md);
}

.w-auth__points svg {
    width: 18px;
    height: 18px;
    flex: none;
    padding: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
}

.w-auth__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--w-space-5);
    padding: var(--w-space-8) var(--w-space-6);
    background: var(--w-canvas);
}

.w-auth__theme { position: absolute; top: var(--w-space-5); right: var(--w-space-5); }

.w-auth__card {
    width: 100%;
    max-width: 420px;
    padding: var(--w-space-8);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius-xl);
    background: var(--w-surface);
    box-shadow: var(--w-shadow-md);
}

.w-auth__logo--mobile {
    display: none;
    margin-bottom: var(--w-space-5);
    font-size: 2rem;
    color: var(--w-text-brand);
}

.w-auth__logo--mobile:hover { color: var(--w-text-brand); }
.w-auth__header { margin-bottom: var(--w-space-6); }

.w-auth__title {
    margin: 0;
    font-size: var(--w-text-2xl);
    font-weight: var(--w-weight-bold);
    letter-spacing: -0.02em;
}

.w-auth__subtitle { margin: var(--w-space-2) 0 0; color: var(--w-text-secondary); font-size: var(--w-text-sm); }

.w-auth__footer {
    margin-top: var(--w-space-6);
    padding-top: var(--w-space-5);
    border-top: 1px solid var(--w-border-subtle);
    text-align: center;
    font-size: var(--w-text-sm);
    color: var(--w-text-secondary);
}

.w-auth__legal { margin: 0; color: var(--w-text-tertiary); font-size: var(--w-text-xs); }

/* Mostrar/ocultar senha */
.w-auth__card .input-group-text { cursor: pointer; }

@media (max-width: 991.98px) {
    .w-auth { grid-template-columns: 1fr; }
    .w-auth__brand { display: none; }
    .w-auth__logo--mobile { display: block; text-align: center; }
}

@media (max-width: 575.98px) {
    .w-auth__panel { padding: var(--w-space-4); justify-content: flex-start; padding-top: var(--w-space-10); }

    /* No celular o cartao vira a propria pagina: borda e sombra so roubariam
       largura util. */
    .w-auth__card {
        max-width: none;
        padding: var(--w-space-5);
        border: 0;
        background: transparent;
        box-shadow: none;
    }
}

/* Codigo de verificacao: seis campos de um digito. */
.w-otp {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--w-space-2);
}

.w-otp .form-control {
    height: 52px;
    padding: 0;
    text-align: center;
    font-family: var(--w-font-mono);
    font-size: var(--w-text-xl);
    font-weight: var(--w-weight-semibold);
}

/*==============================================================================
  Paginas de erro
==============================================================================*/

.w-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--w-space-3);
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--w-space-6);
    text-align: center;
    background: var(--w-canvas);
}

.w-error__code {
    font-size: clamp(4rem, 18vw, 8rem);
    font-weight: var(--w-weight-bold);
    line-height: 1;
    letter-spacing: -0.04em;
    /* O numero e decoracao: forte o bastante para orientar, discreto o bastante
       para nao competir com a frase que explica o que aconteceu. */
    background: linear-gradient(140deg, var(--w-accent), var(--w-brand-400));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.w-error__title { margin: 0; font-size: var(--w-text-2xl); font-weight: var(--w-weight-bold); letter-spacing: -0.02em; }
.w-error__text { margin: 0; max-width: 46ch; color: var(--w-text-secondary); }
.w-error__actions { display: flex; flex-wrap: wrap; gap: var(--w-space-3); margin-top: var(--w-space-5); }

@media (max-width: 575.98px) {
    .w-error__actions { width: 100%; flex-direction: column; }
    .w-error__actions .btn { width: 100%; }
}
