/* TF7 Gestão: estilos específicos de cada página (tokens em app.css). */

/* ================= Login ================= */
.pg-login { background: var(--card); }
.login { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.login-art {
  display: grid; justify-items: center; align-content: center; gap: 14px; text-align: center;
  padding: calc(28px + var(--sat)) 24px 8px;
}
.login-art-in { display: grid; justify-items: center; gap: 14px; }
.login-logo { width: 148px; height: 148px; mix-blend-mode: multiply; }
.login-kicker { font-weight: 300; font-size: 13px; letter-spacing: .32em; text-transform: uppercase; }
.login-foot { display: none; }
.login-panel { display: grid; align-content: start; justify-items: center; padding: 20px max(20px, var(--sar)) calc(32px + var(--sab)) max(20px, var(--sal)); }
.login-form { width: 100%; max-width: 400px; display: grid; gap: 20px; }
.login-head { display: grid; gap: 8px; }
.login-head .eyebrow { display: none; }
.login-head .page-title { font-size: 28px; }
.login-head .ink-2 { font-size: 14px; }
.login-btn { --h: 52px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
.login-help { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }
.login .form-error svg { color: var(--crit); }
.login .form-error .num { font-weight: 600; }
@media (min-width: 900px) {
  .login { grid-template-rows: none; grid-template-columns: minmax(0, 1.1fr) minmax(440px, .9fr); }
  .login-art {
    position: relative; background: var(--canvas); padding: 48px; align-content: stretch; grid-template-rows: 1fr auto;
    border-right: 1px solid var(--line);
  }
  .login-art::before {
    /* moldura editorial em linha fina */
    content: ''; position: absolute; inset: 28px; border: 1px solid var(--line); pointer-events: none;
  }
  .login-art-in { align-self: center; gap: 22px; }
  .login-logo { width: 260px; height: 260px; }
  .login-kicker { font-size: 14px; letter-spacing: .4em; }
  .login-foot { display: block; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding-bottom: 12px; }
  .login-panel { align-content: center; padding: 48px 56px; }
  .login-head .page-title { font-size: 34px; }
  .login-head .eyebrow { display: block; }
}

/* ================= Home ================= */
.hello { display: grid; gap: 10px; }
.hello h1 { font-size: 30px; font-weight: 300; line-height: 1.15; letter-spacing: -.01em; }
.hello h1 b { font-weight: 600; }
@media (min-width: 720px) { .hello h1 { font-size: 40px; } }

.modules { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.module {
  display: grid; grid-template-rows: auto 1fr auto; gap: 18px; padding: 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s var(--ease), box-shadow .2s var(--ease);
}
.module:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.module-top { display: grid; gap: 12px; }
.module-top .rule-accent { margin-bottom: 2px; }
.module h3 { font-size: 21px; font-weight: 400; line-height: 1.3; letter-spacing: -.005em; }
.module p.desc { color: var(--ink-2); font-size: 14px; }
.module-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.module-actions .btn:first-child { flex: 1 1 auto; }
@media (min-width: 520px) { .module-actions .btn:first-child { flex: 0 0 auto; } }
@media (max-width: 519px) { .module-actions .btn-ghost { flex: 1 1 100%; } }
.module-note { flex: 1 1 100%; display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.module-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.module-data {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start;
  padding: 14px 16px; background: var(--canvas); border-radius: var(--radius); font-size: 13px;
}
.module-data > svg { width: 20px; height: 20px; color: var(--ink-2); grid-row: span 2; margin-top: 1px; }
.module-data b { font-weight: 600; font-size: 13.5px; }
.module-data .meta { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.module-data.warn { background: var(--warn-soft); }
.module-data.warn > svg { color: var(--warn); }
.module-data.erro > svg { color: var(--crit); }
.module-data .sk { height: 12px; }
.module-stack { display: grid; gap: 10px; align-content: start; }
/* integração SISBlink no cartão do Vendas */
.module-sync { display: grid; gap: 6px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12.5px; line-height: 1.45; }
.module-sync .sk { height: 12px; }
.sync-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.sync-head b { font-weight: 600; font-size: 13px; }
.sync-line { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; color: var(--ink-2); }
.sync-line svg { width: 14px; height: 14px; margin-top: 2px; color: var(--ink-2); }
.sync-line b { font-weight: 600; color: var(--ink); }
.sync-line.muted { color: var(--muted); }
.sync-line.erro svg { color: var(--crit); }
.selo { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 3px 7px; border-radius: var(--radius); white-space: nowrap; }
.selo.ok { background: var(--ok-soft); color: var(--ok); }
.selo.warn { background: var(--warn-soft); color: var(--warn); }
.warn-txt { color: var(--warn); font-weight: 600; }
.crit-txt { color: var(--crit); }
.module-alt { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding-top: 8px; border-top: 1px solid var(--track); font-size: 12px; color: var(--muted); }
.module-alt > span { margin-right: 4px; letter-spacing: .04em; }
.module-alt .btn-text { --h: 34px; padding: 0 8px; font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.module-alt .btn-text svg { width: 15px; height: 15px; }
@media (max-width: 519px) { .module-actions .btn-sync { flex: 1 1 100%; } }

.admin-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.admin-tile {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; min-height: 76px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
  transition: border-color .15s var(--ease);
}
.admin-tile > svg:first-child { width: 22px; height: 22px; color: var(--ink-2); }
.admin-tile > svg:last-child { width: 18px; height: 18px; color: var(--muted); transition: transform .15s var(--ease), color .15s; }
.admin-tile b { display: block; font-weight: 600; font-size: 14px; }
.admin-tile span { display: block; font-size: 12.5px; color: var(--muted); }
.admin-tile:hover { border-color: var(--ink); }
.admin-tile:hover > svg:last-child { transform: translateX(3px); color: var(--accent); }

/* Painel obrigatório de troca de senha */
.force { min-height: calc(100dvh - var(--sat)); display: grid; place-items: center; padding: calc(24px + var(--sat)) 16px calc(32px + var(--sab)); background: var(--canvas); }
.force-card { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px; display: grid; gap: 22px; box-shadow: var(--shadow); }
@media (min-width: 520px) { .force-card { padding: 36px 36px 32px; } }
.force-card .force-logo { width: 96px; height: 96px; mix-blend-mode: multiply; justify-self: center; margin-top: -8px; }
.force-head { display: grid; gap: 8px; text-align: center; justify-items: center; }
.force-head h1 { font-size: 24px; font-weight: 300; }
.force-head p { color: var(--ink-2); font-size: 14px; }
.force-foot { display: grid; gap: 2px; justify-items: center; text-align: center; font-size: 13px; word-break: break-all; }

/* Upload */
.drop {
  position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px 18px;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--canvas); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over { border-color: var(--ink); background: var(--card); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop > svg { width: 28px; height: 28px; color: var(--ink-2); }
.drop b { font-size: 14px; font-weight: 600; }
.drop span { font-size: 12.5px; color: var(--muted); }
.filecard { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 8px 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.filecard > svg { width: 24px; height: 24px; color: var(--ink-2); }
.filecard b { display: block; font-size: 14px; font-weight: 600; word-break: break-all; }
.filecard span { font-size: 12.5px; color: var(--muted); }
.upload-progress { display: grid; gap: 8px; }
.upload-progress .row { display: flex; justify-content: space-between; font-size: 13px; }
.upload-progress .hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
/* processamento no servidor: barra indeterminada (parada com prefers-reduced-motion) */
.progress.indeterminado i { width: 35% !important; animation: progresso-vai 1.2s var(--ease) infinite; }
@keyframes progresso-vai { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .progress.indeterminado i { width: 100% !important; opacity: .5; animation: none; } }
.xl-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 0 4px; border-top: 1px solid var(--line); justify-content: center; }
.xl-correcoes { display: grid; gap: 8px; }
.xl-correcoes ul { display: grid; border: 1px solid var(--line); border-radius: var(--radius); }
.xl-correcoes li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--track); }
.xl-correcoes li:last-child { border-bottom: 0; }
.xl-correcoes li span { color: var(--ink-2); min-width: 0; }
.xl-correcoes li b { font-weight: 600; white-space: nowrap; }
.done { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 12px 0 4px; }
.done .empty-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.done .empty-mark svg { width: 26px; height: 26px; }
.done h3 { font-weight: 300; letter-spacing: .18em; text-transform: uppercase; font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; word-break: break-word; }

/* ================= Admin: comum ================= */
.explain {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 13.5px; color: var(--ink-2); line-height: 1.5;
}
.explain > svg { width: 20px; height: 20px; flex: none; color: var(--accent); margin-top: 1px; }
.explain strong { color: var(--ink); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
@media (min-width: 720px) { .stats { display: flex; flex-wrap: wrap; gap: 8px 40px; } }
.stat { display: grid; gap: 0; }
.stat b { font-size: 24px; font-weight: 300; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* lista de checagem dentro de diálogos (grupos, módulos) */
.checklist { display: grid; border: 1px solid var(--line); border-radius: var(--radius); max-height: 260px; overflow-y: auto; }
.checklist .check { padding: 10px 14px; border-bottom: 1px solid var(--track); }
.checklist .check:last-child { border-bottom: 0; }
.checklist .check:hover { background: var(--hover); }
.checklist-empty { padding: 14px; font-size: 13px; color: var(--muted); }

/* ================= Admin: grupos ================= */
.matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.matrix th, .matrix td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; background: var(--card); }
.matrix thead th { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.matrix thead th.mod { min-width: 170px; color: var(--ink-2); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; white-space: normal; line-height: 1.35; }
.matrix tbody th { position: sticky; left: 0; z-index: 1; min-width: 240px; font-weight: 400; box-shadow: 1px 0 0 var(--line); }
.matrix tbody tr:last-child > * { border-bottom: 0; }
.matrix tbody tr:hover > * { background: var(--hover); }
.grp-name { display: grid; gap: 2px; }
.grp-name b { font-weight: 600; font-size: 14.5px; }
.grp-name span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.grp-name .members { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.grp-name .members svg { width: 14px; height: 14px; }
.matrix td.acts { width: 1%; white-space: nowrap; text-align: right; }
.matrix td .switch { margin-left: -4px; }
@media (max-width: 759px) {
  .matrix-wrap { overflow: visible; }
  .matrix, .matrix tbody, .matrix tr, .matrix th, .matrix td { display: block; width: 100%; }
  .matrix thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .matrix tbody { display: grid; gap: 10px; }
  .matrix tr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
  .matrix tbody th { position: static; box-shadow: none; min-width: 0; padding: 16px 16px 12px; }
  .matrix td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 16px; border-bottom: 1px solid var(--track); }
  .matrix td::before { content: attr(data-label); font-size: 13px; color: var(--ink-2); font-weight: 500; flex: 1; min-width: 0; }
  .matrix td .switch { margin: 0; flex-direction: row-reverse; }
  .matrix td.acts { width: 100%; justify-content: flex-start; padding: 8px 12px; border-bottom: 0; background: var(--canvas); }
  .matrix td.acts::before { display: none; }
  .matrix tbody tr:hover > * { background: var(--card); }
  .matrix tbody tr:hover > td.acts { background: var(--canvas); }
}
.bymod { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.bymod-card { display: grid; gap: 14px; align-content: start; }
.bymod-card header { display: grid; gap: 6px; }
.bymod-card h3 { font-size: 17px; font-weight: 400; line-height: 1.3; }
.bymod-card .desc { font-size: 13px; color: var(--ink-2); }
.bymod-list { display: grid; border-top: 1px solid var(--line); }
.bymod-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--track); padding: 2px 0; }
.bymod-list li:last-child { border-bottom: 0; }
.bymod-list .g { display: grid; min-width: 0; }
.bymod-list .g b { font-size: 14px; font-weight: 500; }
.bymod-list .g span { font-size: 12px; color: var(--muted); }

/* ================= Admin: perfis ================= */
.perfis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.perfil { display: grid; grid-template-rows: auto 1fr auto; gap: 16px; padding: 22px; }
.perfil header { display: grid; gap: 8px; }
.perfil .title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.perfil h3 { font-size: 18px; font-weight: 400; }
.perfil .desc { font-size: 13.5px; color: var(--ink-2); }
.perfil .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); }
.perfil .meta span { display: inline-flex; gap: 6px; align-items: center; }
.perfil .meta svg { width: 14px; height: 14px; }
.perfil .fn-groups { display: grid; gap: 10px; align-content: start; }
.perfil .fn-group { display: grid; gap: 6px; }
.perfil .fn-group > span { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.perfil footer { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.perfil footer .btn:first-child { flex: 1; }
@media (min-width: 520px) { .perfil footer .btn:first-child { flex: 0 0 auto; } .perfil footer .spacer { flex: 1; } }
.fn-editor { display: grid; gap: 14px; }
.fn-block { border: 1px solid var(--line); border-radius: var(--radius); }
.fn-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 14px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.fn-block-head .check { font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.fn-block-head .all-hint { font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.fn-block-head .count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fn-block-body { display: grid; padding: 0 14px; }
.fn-block-body .check { border-bottom: 1px solid var(--track); }
.fn-block-body .check:last-child { border-bottom: 0; }
.fn-block-body code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ================= Admin: auditoria ================= */
.audit .t-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit .t-when b { font-weight: 600; display: block; font-size: 14px; }
.audit .t-when span { font-size: 12px; color: var(--muted); }
.audit .t-acao .tag { font-family: var(--mono); letter-spacing: .02em; text-transform: none; font-size: 12px; font-weight: 500; }
.audit .t-detalhe { color: var(--ink-2); font-size: 13.5px; max-width: 52ch; word-break: break-word; }
.audit .t-ip { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.audit .t-user { word-break: break-all; font-size: 13.5px; }
.tag.a-login { background: var(--ok-soft); color: var(--ok); }
.tag.a-falha { background: var(--crit-soft); color: #9a0716; }
.tag.a-alter { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.more-row { display: grid; justify-items: center; gap: 8px; padding: 8px 0; }
.more-row p { font-size: 12.5px; color: var(--muted); }

.modal [data-step] { display: grid; gap: 14px; }
.modal [data-step][hidden] { display: none; }
@media (max-width: 759px) {
  /* auditoria compacta no celular: hora + ação na 1ª linha, depois usuário, detalhe e IP */
  .rtable.audit tr:not(.row-day) { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 16px; align-items: center; }
  .rtable.audit td { display: block; padding: 0; border: 0 !important; }
  .rtable.audit td::before { display: none; }
  .audit .t-when { grid-row: 1; grid-column: 1; }
  .audit .t-acao { grid-row: 1; grid-column: 2; justify-self: end; }
  .audit .t-user, .audit .t-detalhe, .audit .t-ip { grid-column: 1 / -1; }
  .audit .t-detalhe:has(.muted) { display: none; }
}
