:root{font-family:Inter,Arial,sans-serif;color:#18212f;background:#f4f6f8}*{box-sizing:border-box}body{margin:0}header{height:64px;background:#0b2741;color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 24px}header b{font-size:24px}header span{color:#55b6e9}header small{margin-left:12px;color:#b9cad8}.master{background:#d9a900;color:#fff!important;padding:4px 8px;border-radius:999px;font-size:11px;font-weight:800}button{border:0;border-radius:8px;padding:10px 14px;background:#1473a8;color:#fff;cursor:pointer}button.secondary{background:#e8edf2;color:#23384b}main{padding:24px;max-width:1500px;margin:auto}.card{background:#fff;border:1px solid #e3e8ee;border-radius:12px;padding:18px;box-shadow:0 2px 8px #0012}.narrow{max-width:420px;margin:80px auto}.narrow input,.toolbar input,.toolbar select,dialog input,dialog select,dialog textarea{width:100%;padding:11px;border:1px solid #ccd5df;border-radius:8px;margin:6px 0 12px}nav{display:flex;gap:8px;margin-bottom:18px;border-bottom:1px solid #dce4eb;padding-bottom:10px}nav button{background:#e8edf2;color:#23384b}nav button.active{background:#1473a8;color:#fff}.toolbar{display:grid;grid-template-columns:2fr 1fr 2fr auto;gap:10px;margin-bottom:16px}.cards{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin-bottom:16px}.metric{background:#fff;border-radius:12px;padding:16px;border-left:5px solid #1473a8}.metric strong{font-size:28px;display:block}.grid{display:grid;grid-template-columns:2fr 1fr;gap:16px}.tablewrap{overflow:auto}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:10px;border-bottom:1px solid #e8edf2}.badge{padding:4px 8px;border-radius:999px;background:#e8f1f7;font-size:12px}.pending{border-left:4px solid #888;padding:8px 10px;margin:8px 0;background:#f8fafb}.pending.PA{border-color:#c33}.pending.PB{border-color:#d99a00}.pending.PC{border-color:#388e3c}.pagehead{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.pagehead h1{margin:0}.pagehead p{margin:5px 0;color:#607080}.notice{padding:14px 16px;background:#fff8df;border:1px solid #f1d47a;border-radius:10px;margin-bottom:16px}dialog{width:min(620px,95vw);border:0;border-radius:12px;padding:24px}dialog::backdrop{background:#0018}.close{float:right;background:#777}.check{display:flex;gap:8px;align-items:center;margin:8px 0 16px}.check input{width:auto;margin:0}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.muted{color:#718096}td button{padding:7px 10px}@media(max-width:900px){.cards{grid-template-columns:1fr 1fr}.grid{grid-template-columns:1fr}.toolbar{grid-template-columns:1fr}.pagehead{align-items:flex-start;gap:12px}}@media print{header,.toolbar,nav,button{display:none!important}body{background:#fff}.card{box-shadow:none;border:0}main{padding:0}}
.structurebar{grid-template-columns:minmax(300px,700px) auto}.subnav{display:flex;gap:8px;margin:8px 0 18px}.subnav button{background:#dfe7ee;color:#20384b}.subnav button.active{background:#1473a8;color:#fff}.tree-card{background:#fff;border:1px solid #e3e8ee;border-radius:10px;margin:8px 0;padding:10px 12px}.tree-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.tree-children{margin-left:24px;border-left:2px solid #e5ebf0;padding-left:12px}.tree-actions{display:flex;gap:6px;flex-wrap:wrap}.tree-actions button{padding:5px 8px;font-size:12px}.tiny{font-size:12px;color:#657786}.danger{background:#b84545!important}.status-on{color:#267a42;font-weight:700}.status-off{color:#8a4a4a;font-weight:700}

/* v0.6 - navegação lateral */
:root{--sidebar-w:245px;--topbar-h:64px}
#sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar-w);background:#0b2741;color:#fff;display:flex;flex-direction:column;z-index:20;box-shadow:2px 0 10px #0012}
#sidebar .brand{height:var(--topbar-h);display:flex;align-items:center;padding:0 22px;border-bottom:1px solid #ffffff18;white-space:nowrap}
#sidebar .brand b{font-size:25px}.brand span{color:#55b6e9}.brand small{margin-left:10px;color:#b9cad8;font-size:11px}
#sidebar nav{display:flex;flex-direction:column;gap:5px;margin:0;padding:20px 12px;border:0;flex:1}
#sidebar nav button{width:100%;text-align:left;background:transparent;color:#d8e5ee;border-radius:8px;padding:12px 14px;font-size:14px}
#sidebar nav button:hover{background:#ffffff12;color:#fff}
#sidebar nav button.active{background:#1473a8;color:#fff;font-weight:700}
#sidebar .sidefoot{padding:16px 22px;color:#8fa7b8;font-size:11px;border-top:1px solid #ffffff18}
header{position:fixed;top:0;left:var(--sidebar-w);right:0;z-index:15;height:var(--topbar-h);justify-content:flex-end;background:#fff;color:#22384b;border-bottom:1px solid #dfe6ec;box-shadow:0 1px 4px #0011}
header .mobileBrand{display:none}header #userName{color:#1473a8}header button{margin-left:8px}
main{max-width:none;margin:0;padding:88px 28px 28px calc(var(--sidebar-w) + 28px)}
#app>.page{max-width:1500px;margin:0 auto}
.pagehead{border-bottom:1px solid #e1e7ec;padding-bottom:12px}.pagehead h1{font-size:28px}
.structurebar{background:#fff;border:1px solid #e3e8ee;border-radius:12px;padding:10px;box-shadow:0 2px 8px #0012}
.subnav{background:#edf2f6;border-radius:10px;padding:5px;display:inline-flex}
.subnav button{background:transparent}.subnav button.active{box-shadow:0 1px 4px #0012}
@media(max-width:900px){:root{--sidebar-w:0px}#sidebar{display:none}header{left:0;justify-content:space-between;background:#0b2741;color:#fff}header .mobileBrand{display:flex;align-items:center}header .mobileBrand b{font-size:21px}header .mobileBrand span{color:#55b6e9}header .mobileBrand small{margin-left:8px;color:#b9cad8}main{padding:82px 14px 20px}.subnav{display:flex;overflow:auto}.subnav button{white-space:nowrap}}
@media print{#sidebar{display:none!important}header{display:none!important}main{padding:0!important}}

/* v0.7 - logotipo oficial EGTsys */
#sidebar .brand{height:94px;padding:10px 16px;justify-content:center}
#sidebar .brand img{display:block;max-width:205px;width:100%;max-height:76px;object-fit:contain}
header .mobileBrand img{display:block;width:120px;max-height:48px;object-fit:contain}
@media(max-width:900px){header .mobileBrand{display:flex}header .mobileBrand img{width:112px;max-height:46px}}


/* v0.8 - menu lateral compacto e recolhível */
:root{--sidebar-w:190px}
#sidebar .brand{height:72px;padding:8px 10px;justify-content:flex-start;gap:8px}
#sidebar .brand img{width:118px;max-width:118px;max-height:54px;object-fit:contain}
.sidebarToggle{width:34px;height:34px;min-width:34px;padding:0;border-radius:8px;background:transparent!important;color:#dce8f1;font-size:20px;line-height:34px;text-align:center}
.sidebarToggle:hover{background:#ffffff18!important}
#sidebar nav{padding:12px 8px;gap:4px}
#sidebar nav button{display:flex;align-items:center;gap:10px;padding:10px 11px;font-size:14px}
.navIcon{width:22px;min-width:22px;text-align:center;font-size:18px;line-height:1}
.navLabel{white-space:nowrap}
#sidebar .sidefoot{padding:12px 14px}
body.sidebar-collapsed{--sidebar-w:66px}
body.sidebar-collapsed #sidebar .brand{justify-content:center;padding:8px 6px}
body.sidebar-collapsed #sidebar .brand img{display:none}
body.sidebar-collapsed #sidebar nav{padding:12px 7px}
body.sidebar-collapsed #sidebar nav button{justify-content:center;padding:11px 8px}
body.sidebar-collapsed .navLabel,body.sidebar-collapsed #sidebar .sidefoot{display:none}
body.sidebar-collapsed .navIcon{width:auto;min-width:0}
@media(max-width:900px){#sidebar{display:flex;width:66px}body{--sidebar-w:66px}#sidebar .brand{height:64px;justify-content:center;padding:8px 6px}#sidebar .brand img{display:none}#sidebar nav{padding:12px 7px}#sidebar nav button{justify-content:center;padding:11px 8px}.navLabel,#sidebar .sidefoot{display:none}.navIcon{width:auto;min-width:0}header{left:66px}.mobileBrand{display:none!important}main{padding:82px 14px 20px 80px}}
