/* APP AVAD — estilos (mobile-first). Paleta oficial aprovada. */
:root {
    --avad-deep: #051824;      /* base institucional */
    --avad-header: #0A3746;    /* cabeçalho escuro */
    --avad-structure: #135360; /* azul petróleo de estrutura */
    --avad-action: #0D939D;    /* turquesa de interação */
    --avad-accent: #D4A25A;    /* dourado de acento */
    --avad-bg: #F6F6F3;        /* fundo claro */
    --avad-support: #698E95;   /* azul acinzentado */
    --avad-neutral: #9BA5A8;   /* cinza neutro */
    --avad-white: #FFFFFF;

    --text: var(--avad-deep);
    --text-muted: #135360;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(5, 24, 36, .06), 0 6px 20px rgba(5, 24, 36, .06);
    --focus: 0 0 0 3px var(--avad-accent);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--avad-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; color: var(--avad-deep); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
.h3 { font-size: 1.05rem; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--avad-structure); text-decoration-color: var(--avad-action); text-underline-offset: 3px; }
a:hover { color: var(--avad-header); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--avad-accent); color: var(--avad-deep); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }

/* ---------- Cabeçalho ---------- */
.topbar { background: var(--avad-header); color: var(--avad-white); position: sticky; top: 0; z-index: 20; border-bottom: 3px solid var(--avad-structure); }
.topbar__inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--avad-white); text-decoration: none; font-weight: 700; letter-spacing: .04em; }
.brand:hover { color: var(--avad-white); }
.brand img { width: 40px; height: auto; }

.menu { position: relative; }
.menu__toggle { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border-radius: var(--radius-sm); color: var(--avad-white); min-height: 44px; background: none; border: 1px solid rgba(255,255,255,.25); font: inherit; cursor: pointer; }
.menu__bars, .menu__bars::before, .menu__bars::after { display: block; width: 20px; height: 2px; background: var(--avad-white); border-radius: 2px; position: relative; }
.menu__bars::before, .menu__bars::after { content: ""; position: absolute; left: 0; }
.menu__bars::before { top: -6px; }
.menu__bars::after { top: 6px; }
.menu__panel {
    position: absolute; right: 0; top: calc(100% + .5rem); min-width: 220px;
    background: var(--avad-deep); border-radius: var(--radius); padding: .5rem; box-shadow: 0 10px 30px rgba(0,0,0,.3);
    display: none; flex-direction: column;
}
.menu.is-open .menu__panel { display: flex; }
.no-js .menu__toggle { display: none; }
.no-js .menu__panel { display: flex; position: static; flex-direction: row; flex-wrap: wrap; background: none; box-shadow: none; padding: 0; min-width: 0; }
.menu__panel a, .menu__panel .linklike {
    color: var(--avad-white); text-decoration: none; padding: .75rem .9rem; border-radius: var(--radius-sm);
    min-height: 44px; display: flex; align-items: center; font: inherit; text-align: left; width: 100%;
}
.menu__panel a:hover, .menu__panel .linklike:hover { background: var(--avad-structure); }
.menu__panel a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--avad-accent); background: rgba(19, 83, 96, .5); }
.menu__logout { margin: 0; }
.menu__cta { border: 1px solid var(--avad-action); }
.linklike { background: none; border: 0; cursor: pointer; }

@media (min-width: 760px) {
    .menu__toggle { display: none; }
    .menu__panel { display: flex; position: static; flex-direction: row; background: none; box-shadow: none; padding: 0; gap: .25rem; min-width: 0; }
    .menu__panel a, .menu__panel .linklike { width: auto; }
    .menu__panel a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--avad-accent); background: none; }
}

/* ---------- Estrutura ---------- */
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }
.main:focus { outline: none; }
.main--narrow { max-width: 640px; }
.footer { text-align: center; padding: 1.5rem 1rem; color: var(--avad-structure); font-size: .9rem; border-top: 1px solid rgba(155, 165, 168, .35); }
.footer p { margin: 0; }
.footer__muted { color: var(--avad-support); font-size: .8rem; }
.page-head { margin-bottom: 1.25rem; }
.stack > * + * { margin-top: 1rem; }
.note { margin-top: 1.5rem; font-size: .9rem; color: var(--text-muted); }

/* ---------- Cartões ---------- */
.card { background: var(--avad-white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); border: 1px solid rgba(155, 165, 168, .25); }
.card--flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card--module { display: flex; flex-direction: column; border-top: 4px solid var(--avad-action); }
.card--module p { flex: 1; color: var(--avad-structure); }
.card--disabled { border-top-color: var(--avad-neutral); }
.card--brain { border-top-color: var(--avad-accent); }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.card__head h2 { font-size: 1.1rem; }
.card__link { font-weight: 600; align-self: flex-start; padding: .25rem 0; }

.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge--ok { background: var(--avad-structure); color: var(--avad-white); }
.badge--wait { background: #FBF3E6; color: var(--avad-deep); border-color: var(--avad-accent); }
.badge--next { background: var(--avad-bg); color: var(--avad-structure); border-color: var(--avad-neutral); }

/* ---------- Boas-vindas ---------- */
.welcome { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.welcome h1 { margin: 0; }
.welcome p { margin: 0; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 46px; padding: .7rem 1.25rem; border-radius: var(--radius-sm);
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 2px solid transparent;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn--primary { background: var(--avad-structure); color: var(--avad-white); border-color: var(--avad-structure); }
.btn--primary:hover { background: var(--avad-header); border-color: var(--avad-action); color: var(--avad-white); }
.btn--ghost { background: var(--avad-white); color: var(--avad-structure); border-color: var(--avad-action); }
.btn--ghost:hover { background: var(--avad-bg); color: var(--avad-header); }
.btn--danger-ghost { background: none; color: var(--avad-structure); border-color: var(--avad-neutral); }
.btn--danger-ghost:hover { border-color: var(--avad-deep); color: var(--avad-deep); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--file { position: relative; overflow: hidden; }
.btn--file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 100px; }
.btn--file:focus-within { box-shadow: var(--focus); }

/* ---------- Formulários ---------- */
.form .field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=url], .field input:not([type]) {
    width: 100%; min-height: 46px; padding: .65rem .8rem; font: inherit; color: var(--text);
    background: var(--avad-white); border: 1.5px solid var(--avad-neutral); border-radius: var(--radius-sm);
}
.field input:focus { border-color: var(--avad-action); box-shadow: 0 0 0 3px rgba(13, 147, 157, .25); outline: none; }
.field input:disabled { background: var(--avad-bg); color: var(--avad-support); }
.field-row { display: flex; gap: .75rem; }
.field-row .field { flex: 1; }
.field--small { max-width: 110px; }
.hint { font-size: .85rem; color: var(--text-muted); margin: .35rem 0 0; }
.field-error { font-size: .88rem; color: var(--avad-deep); margin: .35rem 0 0; padding-left: .6rem; border-left: 3px solid var(--avad-accent); font-weight: 600; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0 1rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--avad-action); }
.password { display: flex; gap: .5rem; }
.password input { flex: 1; }
.password__toggle { min-width: 84px; background: var(--avad-bg); border: 1.5px solid var(--avad-neutral); border-radius: var(--radius-sm); font: inherit; font-size: .9rem; color: var(--avad-structure); cursor: pointer; }

/* ---------- Alertas ---------- */
.alert { border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem; border-left: 5px solid; background: var(--avad-white); box-shadow: var(--shadow); }
.alert--success { border-color: var(--avad-action); }
.alert--error { border-color: var(--avad-accent); background: #FBF3E6; }
.alert--info { border-color: var(--avad-support); }

/* ---------- Autenticação ---------- */
.auth { display: flex; justify-content: center; }
.auth__card { width: 100%; max-width: 440px; background: var(--avad-white); border-radius: var(--radius); padding: 1.5rem 1.25rem; box-shadow: var(--shadow); }
.auth__logo { display: block; margin: 0 auto 1rem; width: 240px; }
.auth__card h1 { text-align: center; }
.auth__links { text-align: center; margin: 1rem 0 .25rem; }
.auth__alt { text-align: center; margin: .75rem 0 0; color: var(--text-muted); }

/* ---------- Landing ---------- */
.hero { text-align: center; padding: 1rem 0 2rem; }
.hero__logo { width: min(520px, 100%); margin-bottom: 1rem; }
.hero__lead { font-size: 1.1rem; max-width: 620px; margin: 0 auto 1.5rem; color: var(--avad-structure); }
.hero__actions { display: flex; flex-direction: column; gap: .75rem; max-width: 360px; margin: 0 auto; }
.hero__note { margin-top: 1rem; }
@media (min-width: 560px) { .hero__actions { flex-direction: row; max-width: none; justify-content: center; } }
.features { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { background: var(--avad-header); color: var(--avad-white); border-radius: var(--radius); padding: 1.25rem; border-bottom: 4px solid var(--avad-accent); }
.feature h2 { color: var(--avad-white); font-size: 1.1rem; }
.feature p { margin: 0; color: #E6EEEF; }

/* ---------- Avatar ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex: 0 0 auto; font-weight: 700; color: var(--avad-white); letter-spacing: .02em; user-select: none; background: var(--avad-structure); }
.avatar--sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar--md { width: 44px; height: 44px; font-size: 1rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.35rem; }
.avatar--xl { width: 120px; height: 120px; font-size: 2.4rem; }
.avatar--c1 { background: var(--avad-structure); }
.avatar--c2 { background: var(--avad-header); }
.avatar--c3 { background: var(--avad-deep); color: var(--avad-accent); }
.avatar--c4 { background: var(--avad-accent); color: var(--avad-deep); }
img.avatar { border: 3px solid var(--avad-white); box-shadow: 0 0 0 2px var(--avad-action); }

/* ---------- Foto de perfil / recorte ---------- */
.photo { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.photo__actions { display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.photo__actions form { margin: 0; }
@media (min-width: 640px) {
    .photo { flex-direction: row; align-items: flex-start; text-align: left; }
    .photo__actions { align-items: flex-start; }
}
.cropper { margin-top: 1.25rem; border-top: 1px solid rgba(155,165,168,.35); padding-top: 1rem; }
.cropper[hidden] { display: none; }
.cropper__hint { font-size: .9rem; color: var(--text-muted); }
.cropper__stage { display: flex; justify-content: center; }
.cropper__stage canvas { width: min(320px, 100%); height: auto; aspect-ratio: 1; border-radius: 50%; background: var(--avad-bg); cursor: grab; touch-action: none; box-shadow: 0 0 0 3px var(--avad-action); }
.cropper__stage canvas:active { cursor: grabbing; }
.cropper__zoom { display: flex; align-items: center; gap: .75rem; max-width: 320px; margin: 1rem auto; }
.cropper__zoom input { flex: 1; accent-color: var(--avad-action); min-height: 44px; }
.cropper__buttons { display: flex; gap: .75rem; justify-content: center; }

/* ---------- Listas, tabelas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list__item { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid rgba(155,165,168,.3); flex-wrap: wrap; }
.list__item:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 1fr; gap: .15rem .75rem; margin: 0 0 1rem; }
.kv dt { font-weight: 600; color: var(--avad-structure); font-size: .85rem; margin-top: .5rem; }
.kv dd { margin: 0; }
@media (min-width: 560px) { .kv { grid-template-columns: 200px 1fr; } .kv dt { margin-top: 0; } }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; background: var(--avad-header); color: var(--avad-white); padding: .7rem .8rem; font-weight: 600; }
.table td { padding: .65rem .8rem; border-bottom: 1px solid rgba(155,165,168,.3); vertical-align: top; }
@media (max-width: 700px) {
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table tr { display: block; border-bottom: 2px solid rgba(155,165,168,.4); padding: .5rem 0; }
    .table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem .9rem; text-align: right; }
    .table td::before { content: attr(data-label); font-weight: 600; color: var(--avad-structure); text-align: left; }
}
.pager { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Instalador ---------- */
.page-plain .plain-logo { text-align: center; margin: .5rem 0 1rem; }
.page-plain .plain-logo img { width: 280px; }
.checks { list-style: none; padding: 0; margin: 0 0 1rem; }
.checks__item { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; font-size: .95rem; }
.checks__icon { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex: 0 0 auto; }
.checks__item--ok .checks__icon { background: var(--avad-structure); color: var(--avad-white); }
.checks__item--fail .checks__icon { background: var(--avad-deep); color: var(--avad-accent); }
.checks__item--warn .checks__icon { background: var(--avad-accent); color: var(--avad-deep); }

/* ---------- Erro ---------- */
.error-page { text-align: center; padding: 2rem 0; max-width: 560px; margin: 0 auto; }
.error-page__code { font-size: 3.5rem; font-weight: 800; color: var(--avad-action); margin: 0; line-height: 1; }
.actions { margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
