/* Tema comum da Animus: cores, superfícies, controles e o casco (menu lateral
   e barra superior montados por /shared/session.js). Carregado depois do CSS de cada tela. */
:root{
  --navy:#04182e;
  --navy-2:#0b315a;
  --navy-3:#174a72;
  --blue:#304d85;
  --blue-2:#476aa6;
  --accent:#2563eb;
  --orange:#ff5c00;
  --cyan:#1be4fc;
  --bg:#f4f6fb;
  --panel:#ffffff;
  --panel-soft:#f8fafc;
  --text:#152035;
  --muted:#667085;
  --line:#e6ebf2;
  --line-strong:#d4dce7;
  --success:#12805a;
  --success-bg:#e9f8f1;
  --warning:#a35f00;
  --warning-bg:#fff5e0;
  --danger:#b42318;
  --danger-bg:#fef0ef;
  --info:#2f5da9;
  --info-bg:#eef3ff;
  --radius:16px;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(17,35,62,.06);
  --shadow-soft:0 1px 2px rgba(16,24,40,.04),0 4px 14px rgba(17,35,62,.045);
  --shadow-hover:0 2px 4px rgba(16,24,40,.05),0 18px 42px rgba(17,35,62,.12);
  --ring:0 0 0 3px rgba(37,99,235,.18);
  --ease:cubic-bezier(.2,.8,.2,1);
  --sb-w:252px;
  --sb-w-collapsed:72px;
  --top-h:60px;
}

*,*::before,*::after{box-sizing:border-box}
html{min-height:100%;background:var(--bg);color-scheme:light;scroll-behavior:smooth}
html,body{margin:0;min-height:100%;font-family:Inter,"Segoe UI Variable Text","Segoe UI",ui-sans-serif,system-ui,-apple-system,Arial,sans-serif;background:var(--bg)!important;color:var(--text)!important;-webkit-font-smoothing:antialiased}
body{min-height:100vh}
button,input,select,textarea{font:inherit}
button{border:0;padding:10px 13px;cursor:pointer}
button:disabled{opacity:.55;cursor:not-allowed;transform:none!important}
a{color:inherit;text-decoration:none;transition:color .16s ease,background .16s ease,border-color .16s ease,transform .16s ease,box-shadow .16s ease}
.hidden{display:none!important}
::selection{background:rgba(37,99,235,.18)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
*{scrollbar-width:thin;scrollbar-color:#c7d2df transparent}

/* Cabeçalhos das telas */
.hero,.app-hero{
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(900px 340px at 92% -30%,rgba(27,228,252,.22),transparent 62%),
    radial-gradient(700px 300px at -5% 130%,rgba(255,92,0,.20),transparent 60%),
    linear-gradient(135deg,var(--navy) 0%,var(--navy-2) 70%,var(--navy-3) 100%)!important;
  color:#fff!important;
  border-bottom:0!important;
  box-shadow:0 18px 40px rgba(4,24,46,.16)!important;
}
.hero::after,.app-hero::after{content:"";position:absolute;left:0;right:0;bottom:0;height:3px;background:linear-gradient(90deg,var(--orange),#ff9a3d 45%,transparent)}
.hero h1,.app-hero h1{color:#fff!important;letter-spacing:-.035em!important}
.hero h1 span,.app-hero h1 span{color:#d8e8f5!important}
.hero h1 b,.app-hero h1 b,.version-badge{color:#fff!important;background:rgba(255,255,255,.12)!important;border-color:rgba(255,255,255,.16)!important}
.hero p,.app-hero p{color:rgba(255,255,255,.78)!important;line-height:1.55}
.hero .eyebrow,.app-hero .eyebrow,.hero .brand-line,.app-hero .brand-line{color:#bfeef5!important}
.hero a,.app-hero a,.hero .links a,.hero-links a{color:#fff!important;border-radius:9px!important}
.hero strong,.app-hero strong{color:#fff!important}
.health-card,.hero-card,.hero-badge,.api-health-card,.status-card,.health{
  background:rgba(255,255,255,.09)!important;
  border:1px solid rgba(255,255,255,.16)!important;
  border-radius:16px!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08)!important;
  color:#fff!important;
  backdrop-filter:blur(8px);
}
.health-card small,.health-card span,.hero-card small,.hero-card span,.status-card small,.status-card span,.health small,.health span{color:rgba(255,255,255,.7)!important}
.health-card strong,.hero-card strong,.status-card strong,.health strong{color:#fff!important}

/* Telas em grade de uma coluna: tabelas largas rolam dentro do painel em vez de alargar a página.
   :where() deixa a especificidade zero, então telas com colunas próprias (Gestão de Rotina) prevalecem. */
:where(.page-shell,.page,.shell){grid-template-columns:minmax(0,1fr)}

/* Superfícies */
.panel{background:var(--panel)!important;border:1px solid var(--line)!important;border-radius:var(--radius)!important;box-shadow:var(--shadow)!important}
.eyebrow{color:var(--blue)!important;letter-spacing:.08em!important;font-size:10px!important;font-weight:900!important;text-transform:uppercase!important}
.muted,.hint,.safe-note{color:var(--muted)!important}

/* Controles */
button,a.primary,a.secondary,a.ghost,a.danger,.template-link{
  border-radius:10px!important;
  font-weight:750!important;
  transition:transform .14s var(--ease),box-shadow .14s ease,background .14s ease,border-color .14s ease,color .14s ease!important;
}
button:hover:not(:disabled),.template-link:hover{transform:translateY(-1px)}
button:active:not(:disabled){transform:translateY(0) scale(.98)}
button.primary,a.primary{background:linear-gradient(180deg,#0d2a4d,var(--navy))!important;color:#fff!important;box-shadow:0 1px 0 rgba(255,255,255,.08) inset,0 6px 16px rgba(4,24,46,.16)}
button.primary:hover,a.primary:hover{background:linear-gradient(180deg,#123764,#0a2747)!important;box-shadow:0 10px 24px rgba(4,24,46,.2)}
button.secondary,a.secondary{background:#edf2f8!important;color:var(--navy)!important;border:1px solid #dbe4ee!important}
button.secondary:hover,a.secondary:hover{background:#e3ebf5!important}
button.ghost,a.ghost{background:#fff!important;color:var(--navy)!important;border:1px solid var(--line-strong)!important}
button.ghost:hover,a.ghost:hover{border-color:#b9c6d6!important;box-shadow:var(--shadow-soft)}
button.danger,a.danger{background:linear-gradient(180deg,#c8352a,var(--danger))!important;color:#fff!important}
button[aria-busy="true"]{position:relative;color:transparent!important}
button[aria-busy="true"]::after{content:"";position:absolute;inset:0;margin:auto;width:16px;height:16px;border-radius:50%;border:2px solid rgba(255,255,255,.5);border-top-color:#fff;animation:nead-spin .7s linear infinite}
input,select,textarea{
  border:1px solid var(--line-strong)!important;
  border-radius:10px!important;
  background:#fff!important;
  color:var(--text)!important;
  outline:none!important;
  min-height:40px;
  transition:border-color .14s ease,box-shadow .14s ease;
}
input:hover,select:hover,textarea:hover{border-color:#bac7d6!important}
input:focus,select:focus,textarea:focus{border-color:var(--accent)!important;box-shadow:var(--ring)!important}
input[type="checkbox"],input[type="radio"]{min-height:0;accent-color:var(--navy)}
input[type="file"]{padding:6px}
input[type="file"]::file-selector-button{border:0;border-radius:8px;background:#edf2f8;color:var(--navy);font-weight:750;padding:7px 12px;margin-right:10px;cursor:pointer}
label{color:var(--muted)}

/* Tabelas */
.table-wrap{scrollbar-width:thin;scrollbar-color:#cbd6e2 transparent}
.table-wrap thead th{position:sticky;top:0;z-index:1}
table{border-collapse:separate!important;border-spacing:0!important}
th{background:#f8fafc!important;color:var(--muted)!important;text-transform:uppercase!important;letter-spacing:.05em!important;font-size:9px!important;font-weight:900!important}
th,td{border-bottom:1px solid #e9eef4!important}
thead th{cursor:pointer;user-select:none}
thead th:hover{color:var(--navy)!important}
thead th[aria-sort]::after{content:"▲";font-size:8px;margin-left:5px;color:var(--accent)}
thead th[aria-sort="descending"]::after{content:"▼"}
tbody tr{transition:background .12s ease}
tbody tr:hover{background:#f5f9ff!important}

/* Feedback e chips */
.message{border-radius:12px!important;border:1px solid var(--line)!important;animation:nead-pop .28s var(--ease)}
.message.success{background:var(--success-bg)!important;color:var(--success)!important;border-color:#c7ead9!important}
.message.warning{background:var(--warning-bg)!important;color:var(--warning)!important;border-color:#f2deb1!important}
.message.error{background:var(--danger-bg)!important;color:var(--danger)!important;border-color:#f3c9c5!important}
.message.info{background:var(--info-bg)!important;color:var(--info)!important;border-color:#d5e0f5!important}
.status,.status-chip,.badge,.mini-chip,.role-chip,.count-chip,.tag,.version-chip{border-radius:999px!important}

/* Cards de navegação */
.choice-card,.module-card,.kpi,.org-card{
  transition:transform .22s var(--ease),box-shadow .22s ease,border-color .22s ease!important;
}
.choice-card:hover,.module-card:hover,.org-card:hover{transform:translateY(-3px);box-shadow:var(--shadow-hover)!important;border-color:#d3deea!important}
.module-card .module-icon,.choice-card .module-icon{transition:transform .22s var(--ease),background .22s ease}
.module-card:hover .module-icon,.choice-card:hover .module-icon{transform:scale(1.06) rotate(-3deg)}
.module-card .action,.choice-card .action{transition:letter-spacing .22s ease}
.module-card:hover .action,.choice-card:hover .action{letter-spacing:.02em}

summary{outline:none;cursor:pointer}
details[open]>summary{margin-bottom:6px}
code{font-family:"Cascadia Code","SFMono-Regular",Consolas,"Liberation Mono",monospace}

/* Entrada suave de painéis (session.js marca os que estão abaixo da dobra) */
.reveal{opacity:0;transform:translateY(14px)}
.reveal.in{opacity:1;transform:none;transition:opacity .5s var(--ease),transform .5s var(--ease)}

@keyframes nead-pop{from{transform:translateY(-4px)}to{transform:none}}
@keyframes nead-spin{to{transform:rotate(360deg)}}
@keyframes nead-fade{from{opacity:0}to{opacity:1}}
@keyframes nead-rise{from{transform:translateY(10px) scale(.98)}to{transform:none}}

@media(max-width:860px){
  .hero,.app-hero{padding-left:18px!important;padding-right:18px!important}
}

/* ---------- Casco: menu lateral e barra superior ---------- */
.nead-icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

body.has-shell{padding-left:var(--sb-w)}
body.shell-animate{transition:padding-left .22s var(--ease)}
body.has-shell.shell-collapsed{padding-left:var(--sb-w-collapsed)}
/* Cabeçalhos que ocupavam a largura toda viram um cartão dentro da área de conteúdo */
body.has-shell>header.hero,body.has-shell>header.app-hero{margin:18px 24px 0;border-radius:20px!important}
.shell-redundant{display:none!important}

.shell-sidebar{position:fixed;inset:0 auto 0 0;width:var(--sb-w);z-index:40;display:flex;flex-direction:column;gap:6px;padding:14px 12px;background:linear-gradient(180deg,#061d37 0%,var(--navy) 100%);color:#c9d6e6;border-right:1px solid rgba(255,255,255,.06);transition:width .22s var(--ease),transform .22s var(--ease)}
.shell-brand{display:flex;align-items:center;gap:11px;padding:6px 8px 14px;margin-bottom:4px;border-bottom:1px solid rgba(255,255,255,.07)}
.shell-logo img{display:block;width:100%;height:100%}
.shell-logo{width:36px;height:36px;flex:none;display:block;border-radius:11px;box-shadow:0 6px 16px rgba(255,92,0,.35)}
.shell-brand-text{display:flex;flex-direction:column;line-height:1.15;white-space:nowrap;overflow:hidden}
.shell-brand-text strong{color:#fff;font-size:14.5px;letter-spacing:-.01em}
.shell-brand-text small{color:#8fa6c0;font-size:11px}
.shell-nav{flex:1;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column;gap:10px;padding-right:2px;scrollbar-color:rgba(255,255,255,.15) transparent}
.shell-section{display:flex;flex-direction:column;gap:2px}
.shell-group{margin:6px 10px 4px;font-size:10px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:#6f88a5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.shell-link{position:relative;display:flex;align-items:center;gap:11px;padding:9px 10px;border-radius:10px;color:#c9d6e6!important;font-size:13.5px;font-weight:600;white-space:nowrap}
.shell-link span{overflow:hidden;text-overflow:ellipsis}
.shell-link:hover{background:rgba(255,255,255,.07);color:#fff!important}
.shell-link.active{background:rgba(255,255,255,.11);color:#fff!important}
.shell-link.active::before{content:"";position:absolute;left:-12px;top:8px;bottom:8px;width:3px;border-radius:0 3px 3px 0;background:var(--orange)}
.shell-link.active .nead-icon{color:var(--cyan)}
.shell-collapse{display:flex;align-items:center;gap:11px;padding:9px 10px!important;background:transparent!important;color:#8fa6c0!important;font-weight:600!important;font-size:12.5px;white-space:nowrap;overflow:hidden}
.shell-collapse:hover{background:rgba(255,255,255,.07)!important;color:#fff!important;transform:none!important}
body.shell-collapsed .shell-sidebar{width:var(--sb-w-collapsed)}
body.shell-collapsed .shell-brand-text,body.shell-collapsed .shell-link span,body.shell-collapsed .shell-collapse span{display:none}
body.shell-collapsed .shell-group{height:1px;margin:6px 8px;background:rgba(255,255,255,.08);color:transparent}
body.shell-collapsed .shell-link,body.shell-collapsed .shell-collapse,body.shell-collapsed .shell-brand{justify-content:center}
body.shell-collapsed .shell-collapse .nead-icon{transform:scaleX(-1)}

.shell-topbar{position:relative;z-index:35;height:var(--top-h);display:flex;align-items:center;gap:12px;padding:0 24px;background:rgba(244,246,251,.82);backdrop-filter:saturate(1.6) blur(12px);border-bottom:1px solid rgba(214,222,232,.7)}
.shell-crumbs{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;color:var(--muted);white-space:nowrap;overflow:hidden}
.shell-crumbs i{font-style:normal;color:#a3afbf}
.shell-crumbs strong{color:var(--text);font-weight:750;overflow:hidden;text-overflow:ellipsis}
.shell-search{margin-left:auto;display:flex;align-items:center;gap:9px;min-width:260px;padding:8px 10px 8px 12px!important;background:#fff!important;border:1px solid var(--line-strong)!important;color:var(--muted)!important;font-weight:500!important;font-size:13px;box-shadow:var(--shadow-soft)}
.shell-search span{flex:1;text-align:left}
.shell-search:hover{border-color:#b9c6d6!important;color:var(--text)!important;transform:none!important}
kbd{font-family:inherit;font-size:10.5px;font-weight:700;color:var(--muted);background:#f1f4f8;border:1px solid var(--line-strong);border-bottom-width:2px;border-radius:6px;padding:1px 6px}
.shell-status{display:flex;align-items:center;gap:7px;padding:6px 11px;border-radius:999px;background:#fff;border:1px solid var(--line);font-size:12px;font-weight:650;color:var(--muted);white-space:nowrap}
.shell-dot{width:8px;height:8px;border-radius:50%;background:#a3afbf}
.shell-status.online .shell-dot{background:#22c55e;box-shadow:0 0 0 0 rgba(34,197,94,.5);animation:nead-pulse 2.4s infinite}
.shell-status.offline .shell-dot{background:#f97316}
@keyframes nead-pulse{0%{box-shadow:0 0 0 0 rgba(34,197,94,.45)}70%{box-shadow:0 0 0 7px rgba(34,197,94,0)}100%{box-shadow:0 0 0 0 rgba(34,197,94,0)}}
.shell-icon-btn{display:grid;place-items:center;width:38px;height:38px;padding:0!important;background:#fff!important;border:1px solid var(--line)!important;color:var(--navy)!important}
.shell-menu-btn{display:none}
.shell-user{position:relative}
.shell-avatar{width:38px;height:38px;padding:0!important;border-radius:50%!important;background:linear-gradient(135deg,var(--blue-2),var(--navy-2))!important;color:#fff!important;font-size:13px;font-weight:800!important;letter-spacing:.02em;box-shadow:0 0 0 2px #fff,0 0 0 3px var(--line-strong)}
.shell-user-menu{position:absolute;right:0;top:calc(100% + 10px);width:280px;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-hover);padding:6px;animation:nead-rise .16s var(--ease)}
.shell-user-head{display:flex;flex-direction:column;gap:2px;padding:10px 12px 12px;border-bottom:1px solid var(--line);margin-bottom:6px}
.shell-user-head strong{font-size:14px}
.shell-user-head small{color:var(--muted);font-size:12px;word-break:break-all}
.shell-roles{margin-top:6px;align-self:flex-start;font-size:11px;font-weight:750;color:var(--info);background:var(--info-bg);border-radius:999px;padding:3px 9px}
.shell-logout{width:100%;display:flex;align-items:center;gap:10px;padding:9px 12px!important;background:transparent!important;color:var(--text)!important;font-weight:600!important}
.shell-logout:hover{background:var(--danger-bg)!important;color:var(--danger)!important;transform:none!important}
.session-pending{background:var(--warning-bg);color:var(--warning);padding:10px 24px;font-size:14px;border-bottom:1px solid #f2deb1}

.shell-scrim{display:none}
.shell-to-top{position:fixed;right:22px;bottom:22px;z-index:30;width:42px;height:42px;padding:0!important;display:grid;place-items:center;border-radius:50%!important;background:var(--navy)!important;color:#fff!important;box-shadow:var(--shadow-hover);opacity:0;pointer-events:none;transform:translateY(10px)!important}
.shell-to-top.visible{opacity:1;pointer-events:auto;transform:none!important}

/* Busca rápida */
.shell-palette{position:fixed;inset:0;z-index:5000;display:flex;justify-content:center;align-items:flex-start;padding:12vh 16px 16px;background:rgba(4,24,46,.42);backdrop-filter:blur(4px)}
.shell-palette.hidden{display:none!important}
.shell-palette-box{width:min(620px,100%);background:#fff;border-radius:16px;box-shadow:0 30px 80px rgba(4,24,46,.35);overflow:hidden;animation:nead-rise .18s var(--ease)}
.shell-palette-input{display:flex;align-items:center;gap:10px;padding:6px 14px;border-bottom:1px solid var(--line);color:var(--muted)}
.shell-palette-input input{flex:1;border:0!important;box-shadow:none!important;min-height:48px;font-size:16px;padding:0;background:transparent!important}
.shell-palette-list{list-style:none;margin:0;padding:6px;max-height:min(420px,55vh);overflow-y:auto}
.shell-palette-list li{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;cursor:pointer;color:var(--text)}
.shell-palette-list li span{display:flex;flex-direction:column;line-height:1.25}
.shell-palette-list li small{color:var(--muted);font-size:12px}
.shell-palette-list li .nead-icon{color:var(--blue)}
.shell-palette-list li.active{background:#eef3ff}
.shell-palette-list li.empty{color:var(--muted);cursor:default;justify-content:center;padding:22px}
.shell-palette-foot{display:flex;gap:16px;margin:0;padding:9px 14px;border-top:1px solid var(--line);font-size:11.5px;color:var(--muted);background:#fafbfd}
.shell-palette-foot kbd{margin-right:3px}

@media(max-width:1100px){
  .shell-search{min-width:0}
  .shell-search span,.shell-search kbd{display:none}
  .shell-status span{display:none}
}
@media(max-width:960px){
  body.has-shell,body.has-shell.shell-collapsed{padding-left:0}
  .shell-sidebar,body.shell-collapsed .shell-sidebar{width:min(280px,86vw);transform:translateX(-102%);z-index:60;box-shadow:24px 0 60px rgba(4,24,46,.3)}
  body.shell-collapsed .shell-brand-text,body.shell-collapsed .shell-link span{display:flex}
  body.shell-collapsed .shell-link,body.shell-collapsed .shell-brand{justify-content:flex-start}
  body.shell-collapsed .shell-group{height:auto;background:none;color:#6f88a5;margin:6px 10px 4px}
  .shell-collapse{display:none!important}
  body.shell-drawer-open .shell-sidebar{transform:none}
  body.shell-drawer-open .shell-scrim{display:block;position:fixed;inset:0;z-index:55;background:rgba(4,24,46,.45);animation:nead-fade .15s ease}
  .shell-menu-btn{display:grid}
  .shell-topbar{padding:0 14px}
  body.has-shell>header.hero,body.has-shell>header.app-hero{margin:12px 12px 0}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
}

/* Aviso de integração no topo (Brightspace, JACAD, Google) */
.shell-alert{display:flex;flex-wrap:wrap;gap:12px 20px;align-items:center;justify-content:space-between;margin:12px 24px 0;padding:12px 16px;border-radius:12px;background:var(--danger-bg);border:1px solid #f3c9c5;color:var(--danger);font-size:13.5px}
.shell-alert.soft{background:var(--warning-bg);border-color:#f2deb1;color:var(--warning)}
.shell-alert p{margin:0}.shell-alert p+p{margin-top:4px}
.shell-alert small{color:inherit;opacity:.8}
.shell-alert-help{font-weight:700}
.shell-alert-actions{display:flex;flex-wrap:wrap;gap:8px}
.shell-alert-actions .primary,.shell-alert-actions .secondary{padding:7px 14px;font-size:13px}
.shell-status.warn .shell-dot{background:#e0a526;box-shadow:0 0 0 3px rgba(224,165,38,.2)}
@media(max-width:900px){.shell-alert{margin:10px 12px 0}}

/* Avisos rápidos */
.shell-toasts{position:fixed;right:18px;bottom:18px;z-index:80;display:grid;gap:8px;max-width:min(420px,calc(100vw - 36px))}
.shell-toast{padding:11px 14px;border-radius:12px;background:#1e293b;color:#fff;font-size:13.5px;box-shadow:0 12px 30px rgba(4,24,46,.25);transition:opacity .4s ease,transform .4s ease}
.shell-toast.warn{border-left:4px solid #f59e0b}.shell-toast.ok{border-left:4px solid #22c55e}
.shell-toast.out{opacity:0;transform:translateY(8px)}

/* Botão sem permissão: desativado, com a explicação no título */
.shell-noperm,button.shell-noperm:hover{opacity:.55;cursor:not-allowed;transform:none!important}
a.shell-noperm{pointer-events:none;text-decoration:line-through}
a.shell-noperm::after{content:" (só administradores)";text-decoration:none;display:inline-block;margin-left:4px;font-size:.9em}
.link-btn{background:none;border:0;padding:0;margin-left:8px;color:var(--blue);font:inherit;font-weight:700;cursor:pointer;text-decoration:underline}
