/* =====================================================================
   Painel do Atendimento — UNIVESP
   Material Design 3 Expressive + identidade do acesso.univesp.br
   ===================================================================== */
:root {
  /* Cores de marca (acesso.univesp.br) */
  --univesp-red: #AF1D27;
  --univesp-dark-red: #8B121A;
  --univesp-item: #A01B24;
  --univesp-deep: #770F1B;

  /* M3 — esquema claro */
  --primary: #AF1D27;
  --on-primary: #FFFFFF;
  --primary-container: #FFDAD6;
  --on-primary-container: #410006;
  --secondary-container: #F7DCD9;
  --on-secondary-container: #2C1513;
  --tertiary: #7A5900;
  --tertiary-container: #FFDF9E;
  --surface: #FDF8F8;
  --surface-dim: #E9E1E1;
  --surface-container-lowest: #FFFFFF;
  --surface-container-low: #F9F2F2;
  --surface-container: #F3EDEF;
  --surface-container-high: #ECE6E8;
  --surface-container-highest: #E6E0E2;
  --on-surface: #1C1B1F;
  --on-surface-variant: #534343;
  --outline: #857373;
  --outline-variant: #D8C2C0;
  --success: #1E7F45;
  --success-container: #C6F0D3;
  --error: #BA1A1A;
  --error-container: #FFDAD6;
  --scrim: rgba(20, 8, 8, .45);
  --shadow: 0 1px 2px rgba(60, 20, 20, .08), 0 2px 8px rgba(60, 20, 20, .06);
  --shadow-2: 0 2px 6px rgba(60, 20, 20, .10), 0 10px 28px rgba(60, 20, 20, .10);
  --shadow-3: 0px 4px 8px 3px rgba(0, 0, 0, .15), 0px 1px 3px rgba(0, 0, 0, .3);

  /* Formas (Expressive: cantos generosos) */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 28px;
  --r-2xl: 36px;
  --r-full: 999px;

  /* Movimento (springs expressivos) */
  --ease-emph: cubic-bezier(.2, 0, 0, 1);
  --ease-emph-decel: cubic-bezier(.05, .7, .1, 1);
  --ease-emph-accel: cubic-bezier(.3, 0, .8, .15);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --spring-soft: cubic-bezier(.22, 1.25, .36, 1);
  --d-short: 150ms;
  --d-med: 300ms;
  --d-long: 500ms;

  --font: 'Montserrat', system-ui, sans-serif;
  --font-display: 'Barlow', 'Montserrat', sans-serif;
  color-scheme: light;
}

/* Esquema escuro */
:root[data-theme="dark"] {
  --primary: #FFB3AC;
  --on-primary: #680010;
  --primary-container: #8E0F1C;
  --on-primary-container: #FFDAD6;
  --secondary-container: #5D3F3C;
  --on-secondary-container: #FFDAD6;
  --tertiary: #F0C048;
  --tertiary-container: #5C4300;
  --surface: #181213;
  --surface-dim: #181213;
  --surface-container-lowest: #120D0D;
  --surface-container-low: #201A1A;
  --surface-container: #251E1E;
  --surface-container-high: #302828;
  --surface-container-highest: #3B3232;
  --on-surface: #EDE0DE;
  --on-surface-variant: #D8C2C0;
  --outline: #A08C8A;
  --outline-variant: #534343;
  --success: #7DDC9C;
  --success-container: #0F5130;
  --error: #FFB4AB;
  --error-container: #93000A;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #FFB3AC; --on-primary: #680010; --primary-container: #8E0F1C; --on-primary-container: #FFDAD6;
    --secondary-container: #5D3F3C; --on-secondary-container: #FFDAD6; --tertiary: #F0C048; --tertiary-container: #5C4300;
    --surface: #181213; --surface-dim: #181213; --surface-container-lowest: #120D0D; --surface-container-low: #201A1A;
    --surface-container: #251E1E; --surface-container-high: #302828; --surface-container-highest: #3B3232;
    --on-surface: #EDE0DE; --on-surface-variant: #D8C2C0; --outline: #A08C8A; --outline-variant: #534343;
    --success: #7DDC9C; --success-container: #0F5130; --error: #FFB4AB; --error-container: #93000A;
    --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
  transition: background-color var(--d-med) var(--ease-emph), color var(--d-med) var(--ease-emph);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.hidden, [hidden] { display: none !important; }
.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal; font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap;
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
  -webkit-font-smoothing: antialiased; user-select: none; flex: none;
}
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; border-radius: 8px; }

/* ===================== LOGIN ===================== */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden;
  background: #2a0d10;
}
.login-bg {
  position: absolute; inset: -40px;
  background: url('../assets/background.jpg') center/cover no-repeat;
  filter: blur(5px) saturate(1.05);
  transform: scale(1.06);
  animation: kenburns 28s var(--ease-emph) infinite alternate;
}
.login-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 10%, rgba(0,0,0,.15), rgba(0,0,0,.55)); }
@keyframes kenburns { from { transform: scale(1.06) translate3d(0,0,0); } to { transform: scale(1.14) translate3d(-1.5%, -1%, 0); } }
.login-card {
  position: relative; width: 440px; max-width: calc(100vw - 32px);
  background: var(--univesp-red); color: #fff;
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-3);
}
.login-head { padding: 28px 24px 22px; text-align: center; background: rgba(0,0,0,.1); }
.login-logo { height: 52px; display: block; margin: 0 auto 14px; }
.login-head h1 { margin: 0; font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 24px; letter-spacing: .5px; }
.login-head h1 span { font-weight: 800; }
.login-bar { height: 5px; background: rgba(0,0,0,.2); }
.login-sub { background: var(--univesp-deep); padding: 18px 24px; text-align: center; font-size: 15px; }
.login-body { background: #FDF8F8; color: #1C1B1F; padding: 28px 28px 22px; display: grid; gap: 16px; }
.btn-ms {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 56px; border-radius: var(--r-full);
  background: var(--univesp-red); color: #fff; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform var(--d-med) var(--spring), background-color var(--d-med) var(--ease-emph), border-radius var(--d-med) var(--ease-emph), box-shadow var(--d-med);
}
.btn-ms svg { background: #fff; border-radius: 6px; padding: 3px; box-sizing: content-box; }
.btn-ms:hover { background: #49454F; border-radius: 18px; box-shadow: var(--shadow-2); }
.btn-ms:active { transform: scale(.97); }
.login-foot { margin: 0; text-align: center; font-size: 12px; color: #534343; display: flex; gap: 6px; align-items: center; justify-content: center; }
.login-foot .ms { font-size: 16px; }
.login-msg { border-radius: var(--r-md); padding: 12px 14px; font-size: 13.5px; background: #FFF4E5; color: #5c3b00; border: 1px solid #ffd79a; animation: shake .5s var(--ease-emph); }
.login-msg.err { background: #FFF1F0; color: #8B121A; border-color: #f3b6b1; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
.login-env { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.85); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; }

.enter { animation: enterUp var(--d-long) var(--ease-emph-decel) both; }
@keyframes enterUp { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* ===================== TOPBAR ===================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--univesp-red) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 0 16px 0 20px; height: 68px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: grid; place-items: center; height: 44px; padding: 0 6px; }
.brand-logo img { height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; border-left: 1px solid rgba(255,255,255,.35); padding-left: 12px; }
.brand-text b { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.brand-text small { font-size: 11.5px; opacity: .85; letter-spacing: .4px; }
.tabs { display: flex; gap: 4px; margin: 0 auto; background: rgba(0,0,0,.16); padding: 4px; border-radius: var(--r-full); }
.tab {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: rgba(255,255,255,.88);
  height: 40px; padding: 0 18px; border-radius: var(--r-full); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: background-color var(--d-med) var(--ease-emph), color var(--d-med), transform var(--d-med) var(--spring);
}
.tab .ms { font-size: 20px; }
.tab:hover { background: rgba(255,255,255,.12); }
.tab.active { background: #fff; color: var(--univesp-red); }
.tab.active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.tab:active { transform: scale(.95); }
.top-actions { display: flex; align-items: center; gap: 8px; position: relative; }
.env-pill { font-size: 10.5px; font-weight: 800; letter-spacing: 1.6px; padding: 5px 10px; border-radius: var(--r-full); background: #FFC107; color: #3a2a00; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-full); border: 0; background: transparent; cursor: pointer; display: grid; place-items: center;
  color: inherit; transition: background-color var(--d-short), border-radius var(--d-med) var(--ease-emph), transform var(--d-med) var(--spring);
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 14px; }
.icon-btn:active { transform: scale(.9); }
.avatar {
  width: 42px; height: 42px; border-radius: var(--r-full); border: 2px solid rgba(255,255,255,.7); background: #fff; color: var(--univesp-red);
  font-weight: 800; font-size: 14px; cursor: pointer; transition: border-radius var(--d-med) var(--ease-emph), transform var(--d-med) var(--spring);
}
.avatar:hover { border-radius: 14px; }
.menu {
  position: absolute; right: 0; top: 54px; width: 300px; background: var(--surface-container); color: var(--on-surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 8px; transform-origin: top right;
  animation: menuIn var(--d-med) var(--ease-emph-decel);
}
@keyframes menuIn { from { opacity: 0; transform: scale(.85) translateY(-8px); } to { opacity: 1; transform: none; } }
.menu-head { padding: 12px 14px; display: grid; gap: 2px; }
.menu-head small { color: var(--on-surface-variant); }
.role-chip { justify-self: start; margin-top: 8px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-full); background: var(--primary-container); color: var(--on-primary-container); text-transform: uppercase; letter-spacing: .6px; }
.menu-sep { height: 1px; background: var(--outline-variant); margin: 6px 8px; }
.menu-info { display: flex; gap: 10px; align-items: center; padding: 8px 14px; font-size: 12.5px; color: var(--on-surface-variant); }
.menu-info .ms { font-size: 18px; }
.menu-item { width: 100%; display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 0; background: transparent; border-radius: var(--r-md); cursor: pointer; font-size: 14px; text-align: left; transition: background-color var(--d-short); }
.menu-item:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }

/* ===================== HERO / FILTROS ===================== */
.hero { position: relative; color: #fff; padding: 26px 0 30px; overflow: hidden; border-radius: 0 0 var(--r-2xl) var(--r-2xl); background: var(--univesp-dark-red); }
.hero-bg { position: absolute; inset: -30px; background: linear-gradient(120deg, rgba(175,29,39,.94), rgba(119,15,27,.92) 55%, rgba(60,6,12,.9)), url('../assets/background.jpg') center 30%/cover; filter: saturate(1.1); }
.hero-bg::after { content: ''; position: absolute; width: 520px; height: 520px; right: -120px; top: -260px; border-radius: 42% 58% 61% 39% / 45% 39% 61% 55%; background: rgba(255,255,255,.06); animation: blob 18s ease-in-out infinite alternate; }
@keyframes blob { to { border-radius: 58% 42% 37% 63% / 59% 61% 39% 41%; transform: rotate(40deg) scale(1.08); } }
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.hero-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.select-wrap { position: relative; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px 0 14px; border-radius: var(--r-full); background: #fff; color: var(--univesp-red); box-shadow: var(--shadow); }
.select-wrap select { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 700; color: #1C1B1F; padding-right: 26px; height: 100%; cursor: pointer; font-size: 15px; }
.select-wrap .caret { position: absolute; right: 12px; pointer-events: none; color: #534343; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.hero-row > * { min-width: 0; }
body { overflow-x: hidden; }
.seg .seg-btn {
  height: 40px; padding: 0 16px; border-radius: var(--r-full); border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); color: #fff;
  font-weight: 600; font-size: 13.5px; cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: background-color var(--d-med) var(--ease-emph), color var(--d-med), border-radius var(--d-med) var(--ease-emph), transform var(--d-med) var(--spring), padding var(--d-med) var(--ease-emph);
}
.seg .seg-btn:hover { background: rgba(255,255,255,.18); }
.seg .seg-btn.active { background: #fff; color: var(--univesp-red); border-color: #fff; border-radius: 14px; padding: 0 18px; }
.seg .seg-btn:active { transform: scale(.94); }
.seg .seg-btn.future { opacity: .55; border-style: dashed; }
.seg .seg-btn .ms { font-size: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  --c: #999;
  height: 36px; padding: 0 14px 0 10px; border-radius: var(--r-full); display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--c) 70%, #fff); background: color-mix(in srgb, var(--c) 30%, transparent); color: #fff; font-weight: 700; font-size: 13px;
  transition: background-color var(--d-med) var(--ease-emph), transform var(--d-med) var(--spring), border-radius var(--d-med) var(--ease-emph), box-shadow var(--d-med);
}
.chip .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255,255,255,.75); transition: transform var(--d-med) var(--spring); }
.chip:hover { background: color-mix(in srgb, var(--c) 55%, transparent); }
.chip.active { background: var(--c); border-color: #fff; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.chip.active .dot { transform: scale(0); width: 0; }
.chip.active::before { content: 'check'; font-family: 'Material Symbols Rounded'; font-size: 18px; animation: pop var(--d-med) var(--spring); }
.chip:active { transform: scale(.93); }
.chip.all { --c: #ffffff; color: #fff; }
.chip.all.active { color: var(--univesp-red); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.headline { margin: 2px 0 0; font-size: 17px; max-width: 1100px; line-height: 1.5; min-height: 26px; }
.headline b { font-weight: 800; }
.headline .hl { padding: 1px 8px; border-radius: 8px; background: rgba(255,255,255,.18); font-weight: 800; }

/* ===================== LAYOUT ===================== */
main.wrap { padding-top: 24px; padding-bottom: 48px; }
.view { animation: viewIn var(--d-long) var(--ease-emph-decel); }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.g-2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.card {
  background: var(--surface-container-lowest); border-radius: var(--r-xl); padding: 20px 22px; box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 55%, transparent);
  transition: box-shadow var(--d-med) var(--ease-emph), transform var(--d-med) var(--ease-emph), border-radius var(--d-med) var(--ease-emph);
  margin-bottom: 20px; min-width: 0;
}
.grid > .card { margin-bottom: 0; }
.card:hover { box-shadow: var(--shadow-2); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-h h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.hint { font-size: 12.5px; color: var(--on-surface-variant); }
.sec-title { font-family: var(--font-display); font-size: 22px; margin: 8px 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-title .ms { color: var(--primary); font-size: 26px; }
.sec-title small { font-family: var(--font); font-size: 12.5px; font-weight: 500; color: var(--on-surface-variant); }
.chart { width: 100%; }
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: none; transition: opacity var(--d-long) var(--ease-emph-decel), transform 700ms var(--ease-emph-decel); }

/* ===================== KPIs ===================== */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 18px 20px 16px; background: var(--surface-container-low);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 50%, transparent); min-height: 150px; display: flex; flex-direction: column; gap: 4px;
  animation: enterUp var(--d-long) var(--ease-emph-decel) both;
  transition: transform var(--d-med) var(--spring), border-radius var(--d-med) var(--ease-emph), box-shadow var(--d-med);
}
.kpi:hover { transform: translateY(-3px); border-radius: 22px; box-shadow: var(--shadow-2); }
.kpi.hero-kpi { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.kpi .k-ico { position: absolute; right: -6px; top: -6px; width: 86px; height: 86px; display: grid; place-items: center; color: color-mix(in srgb, var(--primary) 70%, transparent); opacity: .9; }
.kpi .k-ico::before { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--primary) 12%, transparent);
  clip-path: polygon(50% 0%, 61% 10%, 75% 6%, 80% 20%, 94% 25%, 90% 39%, 100% 50%, 90% 61%, 94% 75%, 80% 80%, 75% 94%, 61% 90%, 50% 100%, 39% 90%, 25% 94%, 20% 80%, 6% 75%, 10% 61%, 0% 50%, 10% 39%, 6% 25%, 20% 20%, 25% 6%, 39% 10%);
  animation: spin 40s linear infinite; }
.kpi:nth-child(2n) .k-ico::before { clip-path: none; border-radius: 38% 62% 55% 45% / 48% 40% 60% 52%; animation: blob 9s ease-in-out infinite alternate; }
@keyframes spin { to { transform: rotate(360deg); } }
.kpi .k-ico .ms { position: relative; font-size: 28px; transform: translate(-6px, 6px); }
.k-label { font-size: 13px; font-weight: 600; color: var(--on-surface-variant); max-width: calc(100% - 64px); }
.kpi.hero-kpi .k-label { color: inherit; opacity: .85; }
.k-value { font-family: var(--font-display); font-size: 46px; font-weight: 600; line-height: 1.05; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.k-value small { font-size: 20px; font-weight: 500; opacity: .7; margin-left: 2px; }
.k-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--on-surface-variant); margin-top: auto; flex-wrap: wrap; }
.kpi.hero-kpi .k-foot { color: inherit; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 12px; padding: 3px 8px 3px 4px; border-radius: var(--r-full); }
.delta .ms { font-size: 16px; }
.delta.up { background: var(--error-container); color: color-mix(in srgb, var(--error) 80%, var(--on-surface)); }
.delta.down { background: var(--success-container); color: color-mix(in srgb, var(--success) 85%, var(--on-surface)); }
.delta.flat { background: var(--surface-container-highest); color: var(--on-surface-variant); }
.delta.good.up { background: var(--success-container); color: color-mix(in srgb, var(--success) 85%, var(--on-surface)); }
.delta.good.down { background: var(--error-container); color: color-mix(in srgb, var(--error) 80%, var(--on-surface)); }

.acc { border-radius: var(--r-xl); padding: 16px 18px; margin-bottom: 20px; background: var(--secondary-container); color: var(--on-secondary-container); animation: enterUp var(--d-long) var(--ease-emph-decel) both; }
.acc-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 12px; flex-wrap: wrap; }
.acc-title small { font-weight: 500; opacity: .8; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.acc-item { background: color-mix(in srgb, var(--surface-container-lowest) 70%, transparent); border-radius: var(--r-lg); padding: 10px 14px; }
.acc-item b { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.acc-item span { font-size: 12px; opacity: .85; }
.acc-item.area { border-left: 6px solid var(--c); }

/* ===================== TEMAS ===================== */
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.theme-card {
  --c: #999;
  border-radius: var(--r-xl); overflow: hidden; background: var(--surface-container-lowest); box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--outline-variant)); display: flex; flex-direction: column;
  transition: transform var(--d-med) var(--spring), box-shadow var(--d-med), border-radius var(--d-med) var(--ease-emph);
}
.theme-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-radius: 22px; }
.theme-h { background: var(--c); color: #fff; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.theme-h.light-text { color: #2b2100; }
.theme-h b { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.theme-h .count { font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1; }
.theme-h small { display: block; font-size: 11.5px; opacity: .9; font-weight: 600; }
.theme-body { padding: 12px 16px 16px; display: grid; gap: 4px; }
.t-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; transition: background-color var(--d-short); }
.t-row:hover { background: color-mix(in srgb, var(--c) 12%, transparent); }
.t-name { font-size: 13.5px; font-weight: 600; }
.t-n { font-weight: 800; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.t-bar { grid-column: 1 / -1; height: 10px; border-radius: var(--r-full); background: color-mix(in srgb, var(--c) 14%, transparent); overflow: hidden; }
.t-bar i { display: block; height: 100%; width: 0; border-radius: var(--r-full); background: var(--c); transition: width 900ms var(--ease-emph-decel); }
.t-delta { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-full); }
.t-delta.up { color: #a01b24; background: #ffe3e0; }
.t-delta.down { color: #1e6b3c; background: #d7f3e1; }
.t-delta.new { color: #6b4b00; background: #ffecb5; }
:root[data-theme="dark"] .t-delta.up { color: #ffb3ac; background: #5e1515; }
:root[data-theme="dark"] .t-delta.down { color: #a6e8bb; background: #10402a; }
:root[data-theme="dark"] .t-delta.new { color: #ffdf9e; background: #4a3500; }
.t-rest { font-size: 12px; color: var(--on-surface-variant); padding: 6px 8px 0; font-weight: 600; }
.theme-empty { color: var(--on-surface-variant); font-size: 13px; padding: 14px 6px; display: flex; gap: 8px; align-items: center; }

/* ===================== RANKINGS ===================== */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: r; }
.rank li { counter-increment: r; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-lg); background: var(--surface-container-low); cursor: pointer;
  transition: transform var(--d-med) var(--spring), background-color var(--d-short), border-radius var(--d-med) var(--ease-emph); animation: enterUp var(--d-long) var(--ease-emph-decel) both; }
.rank li:hover { transform: translateX(4px); background: var(--surface-container); border-radius: 14px; }
.rank li::before { content: counter(r); width: 40px; height: 40px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 18px; border-radius: 14px; background: var(--primary-container); color: var(--on-primary-container); }
.rank li:first-child::before { background: var(--univesp-red); color: #fff; border-radius: 50%; }
.rank .r-name { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .r-sub { display: block; font-size: 12px; color: var(--on-surface-variant); font-weight: 500; }
.rank .r-n { font-family: var(--font-display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.rank .r-bar { grid-column: 2 / -1; height: 6px; border-radius: 6px; background: var(--surface-container-highest); overflow: hidden; margin-top: -4px; }
.rank .r-bar i { display: block; height: 100%; background: var(--primary); width: 0; border-radius: 6px; transition: width 900ms var(--ease-emph-decel); }

/* ===================== POSTAGENS ===================== */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.field { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: var(--r-full); background: var(--surface-container-high); flex: 1 1 220px; min-width: 0; transition: background-color var(--d-short), box-shadow var(--d-short); }
.field:focus-within { background: var(--surface-container-highest); box-shadow: inset 0 0 0 2px var(--primary); }
.field input, .field select { border: 0; background: transparent; font: inherit; color: inherit; outline: none; width: 100%; min-width: 0; height: 100%; }
.field select option { color: #1C1B1F; }
.field .ms { color: var(--on-surface-variant); }
.list-meta { font-size: 13px; color: var(--on-surface-variant); margin: 4px 4px 12px; }
.posts { display: grid; gap: 10px; }
.post { border-radius: var(--r-lg); background: var(--surface-container-low); padding: 14px 16px; border-left: 6px solid var(--c, var(--outline)); animation: enterUp var(--d-med) var(--ease-emph-decel) both; }
.post-h { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; color: var(--on-surface-variant); margin-bottom: 6px; }
.post-h b { color: var(--on-surface); font-size: 13.5px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-full); background: var(--surface-container-highest); color: var(--on-surface-variant); }
.tag.theme { background: color-mix(in srgb, var(--c, var(--primary)) 18%, transparent); color: var(--on-surface); }
.post p { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .more { margin-top: 6px; font-size: 12px; color: var(--on-surface-variant); display: flex; gap: 6px; align-items: center; }

/* ===================== ACESSOS ===================== */
.form { display: grid; gap: 14px; }
.tf { position: relative; display: block; }
.tf input { width: 100%; height: 56px; border-radius: var(--r-sm) var(--r-sm) 0 0; border: 0; border-bottom: 2px solid var(--outline); background: var(--surface-container-high); padding: 20px 16px 6px; font: inherit; color: inherit; outline: none; transition: border-color var(--d-short), background-color var(--d-short); }
.tf input:focus { border-color: var(--primary); background: var(--surface-container-highest); }
.tf span { position: absolute; left: 16px; top: 17px; color: var(--on-surface-variant); pointer-events: none; transition: all var(--d-med) var(--ease-emph); }
.tf input:focus + span, .tf input:not(:placeholder-shown) + span { top: 7px; font-size: 11.5px; color: var(--primary); }
.seg-sm { background: var(--surface-container-high); padding: 4px; border-radius: var(--r-full); }
.seg-sm .seg-btn { flex: 1; justify-content: center; height: 40px; border: 0; color: var(--on-surface-variant); background: transparent; }
.seg-sm .seg-btn:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.seg-sm .seg-btn.active { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn { height: 48px; padding: 0 22px; border-radius: var(--r-full); border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; cursor: pointer; font-size: 14px;
  transition: border-radius var(--d-med) var(--ease-emph), transform var(--d-med) var(--spring), box-shadow var(--d-med), background-color var(--d-short); }
.btn:hover { border-radius: 16px; box-shadow: var(--shadow); }
.btn:active { transform: scale(.95); }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.text { background: transparent; color: var(--primary); height: 40px; padding: 0 12px; }
.help { margin: 0; font-size: 12.5px; color: var(--on-surface-variant); }
.users { display: grid; gap: 8px; }
.user { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--r-lg); background: var(--surface-container-low); animation: enterUp var(--d-med) var(--ease-emph-decel) both; }
.user .u-av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--primary-container); color: var(--on-primary-container); }
.user.admin .u-av { background: var(--univesp-red); color: #fff; border-radius: 14px; }
.user .u-mail { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.user .u-sub { font-size: 12px; color: var(--on-surface-variant); }
.user .u-act { display: flex; gap: 6px; align-items: center; }
.user select { height: 36px; border-radius: var(--r-full); border: 1px solid var(--outline-variant); background: var(--surface-container-lowest); color: inherit; padding: 0 10px; font: inherit; font-size: 13px; }
.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-full); background: var(--surface-container-highest); color: var(--on-surface-variant); display: inline-flex; gap: 4px; align-items: center; }
.badge .ms { font-size: 14px; }
.audit { display: grid; gap: 2px; max-height: 420px; overflow: auto; font-size: 13px; }
.audit div { display: grid; grid-template-columns: 150px 240px 1fr; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.audit div:nth-child(odd) { background: var(--surface-container-low); }
.audit time { color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }

/* ===================== SHEET / SNACK ===================== */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; animation: fade var(--d-med) var(--ease-emph); }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(620px, calc(100vw - 24px)); background: var(--surface-container-low); z-index: 61; border-radius: var(--r-2xl); box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden; animation: sheetIn var(--d-long) var(--ease-emph-decel); }
@keyframes sheetIn { from { transform: translateX(105%); } to { transform: none; } }
.sheet.closing { animation: sheetOut var(--d-med) var(--ease-emph-accel) forwards; }
@keyframes sheetOut { to { transform: translateX(105%); } }
.sheet-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 12px 24px; border-bottom: 1px solid var(--outline-variant); }
.sheet-h small { color: var(--on-surface-variant); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.sheet-h h3 { margin: 4px 0 0; font-family: var(--font-display); font-size: 22px; }
.sheet-body { overflow: auto; padding: 16px 20px 24px; display: grid; gap: 10px; align-content: start; }
.snack { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: #322F35; color: #F5EFF7; padding: 14px 20px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); z-index: 80; font-size: 14px; transition: transform var(--d-long) var(--spring); max-width: calc(100vw - 32px); }
.snack.show { transform: translate(-50%, 0); }

/* ===================== SKELETON ===================== */
.sk { display: inline-block; border-radius: 10px; background: linear-gradient(90deg, rgba(255,255,255,.14) 25%, rgba(255,255,255,.3) 50%, rgba(255,255,255,.14) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.sk-line { width: min(720px, 90%); height: 20px; }
.kpi .sk, .card .sk { background: linear-gradient(90deg, var(--surface-container-high) 25%, var(--surface-container-highest) 50%, var(--surface-container-high) 75%); background-size: 200% 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.foot-note { font-size: 12.5px; color: var(--on-surface-variant); display: flex; gap: 8px; align-items: flex-start; margin: 4px 4px 0; }
.foot-note .ms { font-size: 18px; }
.empty { padding: 40px 12px; text-align: center; color: var(--on-surface-variant); display: grid; gap: 8px; justify-items: center; }
.empty .ms { font-size: 44px; color: var(--outline); }

/* ===================== RESPONSIVO ===================== */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
  .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
  .brand-text small { display: none; }
}
@media (max-width: 860px) {
  .topbar { backdrop-filter: none; background: var(--univesp-red); }
  .topbar-inner { height: 60px; padding: 0 10px; gap: 8px; justify-content: space-between; }
  .brand-text { display: none; }
  .tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); background: var(--univesp-red); box-shadow: var(--shadow-3); z-index: 50; padding: 6px; }
  .tab { flex-direction: column; gap: 2px; height: 56px; padding: 0 16px; font-size: 11.5px; border-radius: 20px; }
  .env-pill { display: none; }
  main.wrap { padding-bottom: 110px; }
  .audit div { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { min-height: 128px; padding: 14px 16px; }
  .k-value { font-size: 36px; }
  .themes, .g-1-1 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 18px 0 22px; border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .headline { font-size: 15px; }
  .hero-row { flex-direction: column; align-items: stretch; }
  .hero-row .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; max-width: none; width: calc(100% + 32px); }
  .select-wrap { align-self: flex-start; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
  .chip { flex: none; }
  .seg .seg-btn { flex: none; }
  .card { padding: 16px; border-radius: var(--r-lg); }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 88vh; border-radius: var(--r-2xl) var(--r-2xl) 0 0; animation-name: sheetUp; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .sheet.closing { animation-name: sheetDown; }
  @keyframes sheetDown { to { transform: translateY(100%); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ===================== IMPRESSÃO / PDF ===================== */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; color: #000; font-size: 11px; }
  .topbar, .tabs, .snack, .sheet, .scrim, .foot-note .ms, #view-topicos, #view-acessos, .hint { display: none !important; }
  .hero { color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; border-radius: 0; }
  .card, .kpi, .theme-card { box-shadow: none !important; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .kpis { grid-template-columns: repeat(5, 1fr); }
  .themes { grid-template-columns: repeat(3, 1fr); }
  .g-2-1 { grid-template-columns: 1.7fr 1fr; }
}
