:root{--navy:#111827;--blue:#173b7a;--purple:#6d28d9;--gold:#f59e0b;--bg:#f5f7fb;--card:#fff;--text:#172033;--muted:#667085;--border:#e7eaf0;--danger:#dc2626;--success:#059669;--warning:#d97706;--shadow:0 16px 40px rgba(17,24,39,.08);--radius:22px}*{box-sizing:border-box}body{font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif;background:var(--bg);color:var(--text);margin:0}.material-symbols-rounded{vertical-align:middle;font-size:22px}.login-screen{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at top left,#3b82f6 0,#141b3a 38%,#0f172a 100%);padding:24px}.login-card{width:min(470px,100%);background:rgba(255,255,255,.95);backdrop-filter:blur(16px);border-radius:30px;padding:34px;box-shadow:0 30px 90px rgba(0,0,0,.35)}.brand-mark{width:72px;height:72px;border-radius:24px;background:linear-gradient(135deg,var(--purple),var(--gold));color:#fff;display:grid;place-items:center;margin-bottom:18px}.brand-mark span{font-size:42px}.login-card h1{font-weight:900;letter-spacing:-.05em}.app-shell{display:flex;min-height:100vh}.sidebar{width:294px;background:linear-gradient(180deg,#101c3c,#12182e 60%,#0b1020);color:#fff;display:flex;flex-direction:column;padding:18px;position:fixed;inset:0 auto 0 0;z-index:1000}.sidebar-brand{display:flex;gap:12px;align-items:center;padding:10px 8px 20px}.sidebar-brand>span{width:45px;height:45px;background:linear-gradient(135deg,var(--gold),var(--purple));border-radius:15px;display:grid;place-items:center;font-weight:900}.sidebar-brand small{display:block;color:#b7c2d7}.menu{display:flex;flex-direction:column;gap:5px;overflow:auto;padding-right:4px}.menu a{color:#dbeafe;text-decoration:none;display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:15px;font-weight:700;font-size:14px;transition:.2s}.menu a:hover,.menu a.active{background:rgba(255,255,255,.13);color:#fff;transform:translateX(3px)}.content-wrapper{margin-left:294px;width:calc(100% - 294px);min-height:100vh}.topbar{height:82px;background:rgba(255,255,255,.86);backdrop-filter:blur(16px);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:50;display:flex;align-items:center;justify-content:space-between;padding:0 26px}.topbar h2{font-weight:900;letter-spacing:-.03em;margin:0}.topbar span{color:var(--muted)}.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.page-content{padding:24px}.ri-card,.kpi-card,.module-card,.report,.timeline-item{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px}.ri-card:hover,.module-card:hover{box-shadow:0 24px 60px rgba(17,24,39,.12);transform:translateY(-1px)}.kpi-card{position:relative;overflow:hidden;min-height:132px}.kpi-card:before{content:"";position:absolute;right:-35px;top:-35px;width:120px;height:120px;border-radius:50%;background:linear-gradient(135deg,rgba(109,40,217,.12),rgba(245,158,11,.16))}.kpi-icon{width:48px;height:48px;border-radius:16px;display:grid;place-items:center;background:#eef2ff;color:var(--purple);margin-bottom:12px}.kpi-value{font-size:30px;font-weight:900;letter-spacing:-.04em}.trend{font-size:12px;font-weight:800}.trend.up{color:var(--success)}.trend.down{color:var(--danger)}.btn-gold{background:linear-gradient(135deg,var(--gold),#f97316);color:#fff;border:0;font-weight:800}.btn-primary{background:linear-gradient(135deg,var(--blue),var(--purple));border:0}.md-btn{border-radius:14px;display:inline-flex;align-items:center;gap:6px;font-weight:800}.icon-btn{width:42px;height:42px;border-radius:14px;display:grid;place-items:center}.filterbar{display:flex;gap:10px;align-items:center;background:#fff;border:1px solid var(--border);border-radius:18px;padding:12px;margin-bottom:14px;box-shadow:var(--shadow);flex-wrap:wrap}.filterbar .form-control,.filterbar .form-select{min-width:190px}.table-wrap{background:#fff;border:1px solid var(--border);border-radius:22px;box-shadow:var(--shadow);padding:14px}.table thead th{font-size:12px;color:#667085;text-transform:uppercase;letter-spacing:.04em;background:#f8fafc}.table td,.table th{white-space:nowrap}.status{display:inline-flex;padding:5px 10px;border-radius:999px;font-weight:900;font-size:12px;background:#eef2ff;color:#3730a3}.status.activo,.status.aprovado,.status.validada,.status.concluída,.status.fechado,.status.ganho{background:#dcfce7;color:#166534}.status.pendente,.status.planeada,.status.em-tratamento{background:#fef3c7;color:#92400e}.status.inactivo,.status.rejeitado,.status.crítico,.status.perdido{background:#fee2e2;color:#991b1b}.status.aberto,.status.em-curso,.status.alto{background:#ffedd5;color:#9a3412}.chart-box{height:360px}.mini-chart{height:240px}.section-title{font-weight:900;margin-bottom:14px}.module-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px}.module-card{cursor:pointer}.module-card .material-symbols-rounded{font-size:34px;color:var(--purple);background:#f3e8ff;border-radius:14px;padding:8px}.timeline{border-left:4px solid var(--purple);margin-left:20px;padding-left:22px}.timeline-item{margin-bottom:16px;position:relative}.timeline-item:before{content:"";position:absolute;left:-35px;top:26px;width:18px;height:18px;background:var(--gold);border-radius:50%;border:4px solid #fff}.score{height:10px;background:#eef2f7;border-radius:30px;overflow:hidden}.score span{display:block;height:100%;background:linear-gradient(90deg,var(--purple),var(--gold))}.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:14px}.photo-card{height:130px;border-radius:18px;background:linear-gradient(135deg,#e0e7ff,#fff7ed);display:grid;place-items:center;border:1px solid var(--border);font-weight:900;color:#475569}#map{height:650px;border-radius:24px;box-shadow:var(--shadow);border:1px solid var(--border)}.toast-ri{position:fixed;right:22px;bottom:22px;background:#111827;color:#fff;padding:14px 18px;border-radius:16px;z-index:3000;box-shadow:0 16px 44px rgba(0,0,0,.25)}@media(max-width:992px){.sidebar{transform:translateX(-102%);transition:.25s}.sidebar.open{transform:translateX(0)}.content-wrapper{margin-left:0;width:100%}.topbar{height:auto;padding:14px;gap:10px;align-items:flex-start}.page-content{padding:14px}.filterbar{display:block}.filterbar>*{width:100%;margin-bottom:8px}.top-actions{justify-content:flex-end}.chart-box{height:300px}}@media print{.sidebar,.topbar,.filterbar,.btn{display:none!important}.content-wrapper{margin:0;width:100%}.page-content{padding:0}.ri-card,.table-wrap,.kpi-card{box-shadow:none;border:1px solid #ddd}}

/* v3.1 - Menu por famílias + perfis completos */
.menu{gap:10px}.menu-group{border:1px solid rgba(255,255,255,.08);border-radius:18px;background:rgba(255,255,255,.035);overflow:hidden}.menu-group-title{width:100%;border:0;background:transparent;color:#fff;display:flex;align-items:center;gap:10px;padding:12px 12px;font-weight:900;text-align:left}.menu-group-title .caret{margin-left:auto;transition:.2s}.menu-group-title.open .caret{transform:rotate(180deg)}.submenu-link{margin:3px 8px 6px 8px;padding:10px 10px!important;border-radius:13px!important;font-size:13px!important;color:#dbeafe!important}.submenu-link span:first-child{font-size:20px}.submenu-link.active{background:linear-gradient(135deg,rgba(245,158,11,.22),rgba(109,40,217,.25))!important}.profile-header{display:flex;gap:16px;align-items:center;background:#f8fafc;border:1px solid var(--border);border-radius:20px;padding:16px}.profile-avatar{width:62px;height:62px;border-radius:22px;background:linear-gradient(135deg,var(--purple),var(--gold));display:grid;place-items:center;color:#fff;overflow:hidden;flex:0 0 auto}.profile-avatar span{font-size:36px}.profile-avatar.xl{width:104px;height:104px;border-radius:30px}.profile-avatar img,.photo-preview img{width:100%;height:100%;object-fit:cover}.photo-preview{display:flex;align-items:center;gap:10px;background:#f8fafc;border:1px dashed var(--border);border-radius:16px;padding:10px}.photo-preview img{width:72px;height:52px;border-radius:12px}.profile-cover{display:flex;gap:18px;align-items:center;background:linear-gradient(135deg,#eef2ff,#fff7ed);border:1px solid var(--border);border-radius:26px;padding:20px;margin-bottom:18px}.detail-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}.detail-row{border:1px solid var(--border);border-radius:16px;padding:12px;background:#fff}.detail-row b{display:block;color:#667085;font-size:12px;text-transform:uppercase;letter-spacing:.04em;margin-bottom:5px}.detail-row span{font-weight:700;word-break:break-word}.btn-outline-info{border-color:#bae6fd;color:#0369a1}.btn-outline-info:hover{background:#e0f2fe;color:#075985}

/* v3.2 - Utilizadores, clientes com perfil e responsividade refinada */
.kpi-card.compact{min-height:112px;padding:15px 16px;border-radius:18px}.kpi-card.compact .kpi-icon{width:40px;height:40px;border-radius:13px;margin-bottom:8px}.kpi-card.compact .kpi-icon span{font-size:22px}.kpi-card.compact .kpi-value{font-size:24px;line-height:1.1}.kpi-card.compact .fw-bold{font-size:13px}.profile-top-btn{display:inline-flex;align-items:center;gap:8px;border-radius:999px;border:1px solid var(--border);font-weight:800;max-width:330px}.top-avatar{width:28px;height:28px;border-radius:50%;overflow:hidden;display:inline-grid;place-items:center;background:#eef2ff;color:var(--purple);flex:0 0 auto}.top-avatar img{width:100%;height:100%;object-fit:cover}.top-avatar .material-symbols-rounded{font-size:20px}.profile-top-btn #profileBadge{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text);max-width:250px}.profile-cover{min-height:auto}.ri-card,.module-card,.report,.timeline-item{padding:16px}.module-grid{grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}.chart-box{height:320px}.table-wrap{padding:10px;border-radius:18px}.filterbar{padding:10px;border-radius:16px}.sidebar{width:286px}.content-wrapper{margin-left:286px;width:calc(100% - 286px)}
@media(max-width:1200px){.chart-box{height:290px}.kpi-card.compact .kpi-value{font-size:22px}}
@media(max-width:992px){.content-wrapper{margin-left:0;width:100%}.profile-top-btn{max-width:220px}.profile-top-btn #profileBadge{max-width:150px}.profile-cover{align-items:flex-start;flex-direction:column}.profile-avatar.xl{width:88px;height:88px}.module-grid{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}}
@media(max-width:576px){.page-content{padding:10px}.topbar{padding:10px}.top-actions{width:100%;justify-content:space-between}.profile-top-btn{max-width:100%;width:100%;justify-content:flex-start}.kpi-card.compact{min-height:104px;padding:12px}.kpi-card.compact .kpi-value{font-size:20px}.ri-card,.module-card,.report,.timeline-item{padding:14px}.detail-grid{grid-template-columns:1fr}.chart-box{height:260px}#map{height:420px}.sidebar{width:290px}.photo-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}}

/* v3.3 - Microsoft Designer / Microsoft 365 Fluent visual refresh */
:root{
  --navy:#0f172a;
  --blue:#2563eb;
  --purple:#7c3aed;
  --gold:#f59e0b;
  --bg:#f6f8fc;
  --card:#ffffff;
  --text:#111827;
  --muted:#5f6b7a;
  --border:#e5e7eb;
  --fluent-blue:#0078d4;
  --fluent-blue-2:#106ebe;
  --fluent-purple:#5c2d91;
  --fluent-teal:#00a6a6;
  --fluent-orange:#ff8c00;
  --shadow:0 4px 14px rgba(17,24,39,.07),0 1px 2px rgba(17,24,39,.04);
  --shadow-hover:0 12px 28px rgba(17,24,39,.12),0 2px 6px rgba(17,24,39,.06);
  --radius:14px;
}
body{
  font-family:"Segoe UI Variable","Segoe UI",Inter,system-ui,-apple-system,sans-serif;
  background:
    radial-gradient(circle at 10% 0%,rgba(0,120,212,.10),transparent 25%),
    radial-gradient(circle at 90% 0%,rgba(124,58,237,.09),transparent 27%),
    linear-gradient(180deg,#f7f9fd 0%,#f3f6fb 100%);
  color:#1f2937;
}
.material-symbols-rounded{font-variation-settings:'FILL' 0,'wght' 500,'GRAD' 0,'opsz' 24}
.login-screen{
  background:
    radial-gradient(circle at 15% 18%,rgba(0,120,212,.32),transparent 25%),
    radial-gradient(circle at 88% 10%,rgba(92,45,145,.34),transparent 24%),
    radial-gradient(circle at 70% 82%,rgba(255,140,0,.24),transparent 23%),
    linear-gradient(135deg,#eef5ff 0%,#f7f5ff 42%,#fff8ef 100%);
}
.login-card{
  border:1px solid rgba(255,255,255,.7);
  background:rgba(255,255,255,.82);
  box-shadow:0 32px 80px rgba(15,23,42,.18);
  border-radius:28px;
  position:relative;
  overflow:hidden;
}
.login-card:before{content:"";position:absolute;inset:0 0 auto 0;height:7px;background:linear-gradient(90deg,#0078d4,#5c2d91,#ff8c00)}
.login-card h1{font-family:"Segoe UI Display","Segoe UI",sans-serif;letter-spacing:-.06em;color:#172033;font-size:34px}
.login-lead{color:#4b5563;font-size:15px}.m365-login-badges{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px}.m365-login-badges span{padding:5px 9px;border-radius:999px;background:#eef6ff;color:#075985;border:1px solid #dbeafe;font-size:12px;font-weight:700}.fluent-logo{background:conic-gradient(from 135deg,#f35325 0 25%,#81bc06 0 50%,#05a6f0 0 75%,#ffba08 0 100%);border-radius:18px}
.sidebar{
  width:292px;
  background:linear-gradient(180deg,#0b1225 0%,#111a33 56%,#0c1324 100%);
  padding:14px 12px;
  border-right:1px solid rgba(255,255,255,.08);
  box-shadow:8px 0 28px rgba(15,23,42,.13);
}
.content-wrapper{margin-left:292px;width:calc(100% - 292px)}
.sidebar-brand{padding:10px 8px 18px;border-bottom:1px solid rgba(255,255,255,.08);margin-bottom:10px}.sidebar-brand strong{font-size:15px}.sidebar-brand small{color:#aebbd0}.sidebar-brand>span:not(.material-symbols-rounded){background:transparent!important}.app-waffle{display:grid!important;grid-template-columns:repeat(2,15px);grid-template-rows:repeat(2,15px);gap:4px;width:42px!important;height:42px!important;border-radius:12px!important;padding:4px;background:rgba(255,255,255,.10)!important}.app-waffle i{display:block;border-radius:5px}.app-waffle i:nth-child(1){background:#f35325}.app-waffle i:nth-child(2){background:#81bc06}.app-waffle i:nth-child(3){background:#05a6f0}.app-waffle i:nth-child(4){background:#ffba08}
.menu{gap:8px;padding-right:3px}.menu::-webkit-scrollbar{width:6px}.menu::-webkit-scrollbar-thumb{background:rgba(255,255,255,.24);border-radius:30px}.menu-group{border:0;background:rgba(255,255,255,.04);border-radius:13px}.menu-group-title{padding:11px 10px;font-size:13px;color:#eef6ff;border-radius:13px}.menu-group-title:hover{background:rgba(255,255,255,.07)}.menu-group-title .material-symbols-rounded:first-child{font-size:20px;color:#74c0fc}.submenu-link{font-weight:650!important;color:#dbeafe!important;gap:9px!important;margin:2px 6px 5px!important;padding:9px 10px!important;border-left:3px solid transparent}.submenu-link:hover{background:rgba(255,255,255,.10)!important;transform:none!important}.submenu-link.active{background:linear-gradient(90deg,rgba(0,120,212,.26),rgba(124,58,237,.20))!important;border-left-color:#60a5fa;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);color:#fff!important}.submenu-link span:first-child{font-size:20px;color:#a7d8ff}
#logoutBtn{border-radius:12px;font-weight:700;background:rgba(255,255,255,.04)}
.topbar{
  height:72px;
  background:rgba(255,255,255,.78);
  backdrop-filter:blur(22px) saturate(170%);
  border-bottom:1px solid rgba(229,231,235,.9);
  box-shadow:0 1px 0 rgba(255,255,255,.78),0 6px 24px rgba(17,24,39,.04);
  padding:0 22px;
}
.title-zone h2,#pageTitle{font-family:"Segoe UI Display","Segoe UI",sans-serif;font-size:24px;font-weight:750;letter-spacing:-.03em;color:#1f2937}.title-zone span,#pageSubtitle{font-size:13px;color:#687385}.m365-command{height:42px;min-width:340px;align-items:center;gap:9px;background:#fff;border:1px solid #dde4ef;border-radius:999px;padding:0 14px;box-shadow:0 2px 8px rgba(15,23,42,.05)}.m365-command input{border:0;outline:0;background:transparent;width:100%;font-size:14px;color:#334155}.m365-command .material-symbols-rounded{color:#64748b}.profile-top-btn{background:#fff;border-color:#dbe4ef;box-shadow:0 2px 8px rgba(15,23,42,.04)}.top-avatar{background:linear-gradient(135deg,#e0f2fe,#ede9fe);color:#0078d4}.top-actions .btn{border-radius:999px}.page-content{padding:20px 22px}
.ri-card,.kpi-card,.module-card,.report,.timeline-item,.table-wrap,.filterbar{
  border:1px solid rgba(226,232,240,.95);
  border-radius:16px;
  box-shadow:var(--shadow);
  background:rgba(255,255,255,.92);
}
.ri-card:hover,.module-card:hover,.kpi-card:hover{box-shadow:var(--shadow-hover);transform:translateY(-2px)}
.kpi-card.compact,.kpi-card{min-height:106px;padding:15px;border-radius:16px}.kpi-card:before{background:linear-gradient(135deg,rgba(0,120,212,.10),rgba(255,140,0,.11));right:-48px;top:-50px}.kpi-icon{width:40px;height:40px;border-radius:12px;background:linear-gradient(135deg,#e8f3ff,#f3edff);color:#0078d4;box-shadow:inset 0 0 0 1px rgba(0,120,212,.08)}.kpi-value{font-size:24px;font-weight:750;color:#111827}.trend.up{color:#107c10}.trend.down{color:#d13438}.section-title{font-family:"Segoe UI Display","Segoe UI",sans-serif;color:#1f2937;font-weight:750}.module-card .material-symbols-rounded{background:linear-gradient(135deg,#e8f3ff,#f3edff);color:#0078d4;border-radius:12px}.module-card h5{font-weight:750;color:#1f2937}.module-card p{color:#64748b}.btn-primary{background:#0078d4;border-color:#0078d4}.btn-primary:hover{background:#106ebe;border-color:#106ebe}.btn-gold{background:linear-gradient(135deg,#0078d4,#5c2d91);border:0;color:#fff}.btn-outline-primary{border-color:#0078d4;color:#0078d4}.btn-outline-primary:hover{background:#0078d4;border-color:#0078d4;color:#fff}.md-btn{border-radius:10px;font-weight:700}.icon-btn{border-radius:10px}.form-control,.form-select{border-radius:10px;border-color:#dbe4ef}.form-control:focus,.form-select:focus{border-color:#0078d4;box-shadow:0 0 0 .2rem rgba(0,120,212,.12)}
.table-wrap{overflow:hidden}.table{margin-bottom:0}.table thead th{background:#f8fafc;color:#475569;font-weight:750;border-bottom:1px solid #e2e8f0}.table tbody tr:hover{background:#f8fbff}.status{border-radius:999px;font-weight:750;padding:5px 10px}.status.activo,.status.aprovado,.status.validada,.status.concluída,.status.fechado,.status.ganho{background:#dff6dd;color:#107c10}.status.pendente,.status.planeada,.status.em-tratamento{background:#fff4ce;color:#8a5600}.status.inactivo,.status.rejeitado,.status.crítico,.status.perdido{background:#fde7e9;color:#a4262c}.status.aberto,.status.em-curso,.status.alto{background:#fed9cc;color:#c43501}.chart-box{height:300px}.profile-cover{background:linear-gradient(135deg,#eff6ff,#f5f3ff 58%,#fff7ed);border-radius:18px}.profile-avatar,.profile-avatar.xl{background:linear-gradient(135deg,#0078d4,#5c2d91)}.detail-row{border-color:#e2e8f0;border-radius:13px}.detail-row b{color:#64748b}.modal-content{border:0;border-radius:18px;box-shadow:0 32px 80px rgba(15,23,42,.25)}.modal-header{border-bottom:1px solid #e5e7eb;background:linear-gradient(135deg,#f8fbff,#fff)}#map{border-radius:18px;height:610px}.toast-ri{background:#1f2937;border-radius:12px;box-shadow:0 16px 42px rgba(15,23,42,.25)}
@media(max-width:1200px){.m365-command{display:none!important}.content-wrapper{margin-left:292px;width:calc(100% - 292px)}}
@media(max-width:992px){.sidebar{width:292px}.content-wrapper{margin-left:0;width:100%}.topbar{height:auto;padding:12px}.page-content{padding:12px}.title-zone h2,#pageTitle{font-size:21px}.chart-box{height:280px}}
@media(max-width:576px){.topbar{gap:10px}.top-actions{gap:6px}.top-actions .btn:not(.profile-top-btn){padding:.35rem .5rem;font-size:12px}.profile-top-btn{border-radius:12px}.kpi-card.compact,.kpi-card{min-height:96px}.ri-card,.module-card,.report,.timeline-item,.table-wrap,.filterbar{border-radius:14px}.module-grid{grid-template-columns:1fr 1fr}.sidebar{width:288px}#map{height:420px}}
