:root{--bg:#f4f6f8;--card:#fff;--text:#18212f;--muted:#667085;--line:#e4e7ec;--accent:#1677ff;--accent2:#0d5fd1;--green:#067647;--red:#b42318;--orange:#b54708;--shadow:0 8px 24px rgba(16,24,40,.06)}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:15px}.topbar{min-height:64px;background:#101828;color:white;display:flex;align-items:center;justify-content:space-between;padding:10px 4vw;gap:20px}.brand{display:flex;align-items:center;gap:10px;color:white;text-decoration:none;font-weight:800;font-size:18px}.brand-mark{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--accent)}.top-user{display:flex;align-items:center;gap:16px;font-size:13px}.top-user a{color:#cfe2ff}.nav{display:flex;gap:4px;padding:0 4vw;background:white;border-bottom:1px solid var(--line);overflow-x:auto}.nav a{padding:14px 16px;color:#344054;text-decoration:none;white-space:nowrap;border-bottom:3px solid transparent}.nav a.active{color:var(--accent);border-bottom-color:var(--accent);font-weight:700}.container{max-width:1320px;margin:24px auto;padding:0 20px;min-height:calc(100vh - 160px)}h1{font-size:28px;margin:0 0 6px}h2{font-size:20px;margin:0 0 16px}.subtle{color:var(--muted);margin-top:0}.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:20px}.actions{display:flex;gap:10px;flex-wrap:wrap}.btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:8px;padding:10px 14px;background:var(--accent);color:white;text-decoration:none;font-weight:700;cursor:pointer;font-size:14px}.btn:hover{background:var(--accent2)}.btn.secondary{background:white;color:#344054;border-color:#d0d5dd}.btn.secondary:hover{background:#f9fafb}.btn.danger{background:#d92d20}.btn.small{padding:6px 9px;font-size:12px}.btn.disabled{opacity:.45;pointer-events:none}.grid{display:grid;gap:16px}.grid.cards{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:20px}.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:20px;box-shadow:var(--shadow)}.metric .label{color:var(--muted);font-size:13px}.metric .value{font-size:30px;font-weight:800;margin-top:6px}.metric .hint{font-size:12px;color:var(--muted);margin-top:4px}.two-col{display:grid;grid-template-columns:1.3fr .7fr;gap:18px}.table-wrap{overflow:auto;background:white;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow)}table{width:100%;border-collapse:collapse;min-width:760px}th,td{text-align:left;padding:12px 14px;border-bottom:1px solid var(--line);vertical-align:middle}th{font-size:12px;text-transform:uppercase;letter-spacing:.03em;color:#475467;background:#f9fafb}tr:last-child td{border-bottom:0}.num{text-align:right}.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px;font-weight:700;background:#eef4ff;color:#3538cd}.badge.low{background:#fef3f2;color:var(--red)}.badge.ok{background:#ecfdf3;color:var(--green)}.filters,.form-card{background:white;border:1px solid var(--line);border-radius:12px;padding:18px;box-shadow:var(--shadow);margin-bottom:18px}.filters form{display:flex;gap:10px;flex-wrap:wrap;align-items:end}.field{display:flex;flex-direction:column;gap:6px;min-width:160px;flex:1}.field label{font-size:13px;font-weight:700;color:#344054}.field input,.field select,.field textarea{width:100%;border:1px solid #d0d5dd;border-radius:8px;padding:10px 11px;background:white;color:#101828;font:inherit}.field textarea{min-height:90px;resize:vertical}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.form-grid .full{grid-column:1/-1}.required::after{content:' *';color:var(--red)}.alert{border-radius:8px;padding:12px 14px;margin-bottom:16px;border:1px solid}.alert.success{background:#ecfdf3;border-color:#abefc6;color:#05603a}.alert.error{background:#fef3f2;border-color:#fecdca;color:#912018}.alert.info{background:#eff8ff;border-color:#b2ddff;color:#175cd3}.access-banner{padding:10px 14px;border-radius:8px;margin-bottom:16px;font-size:13px}.access-banner.trial{background:#fff6ed;color:#9c2a10}.access-banner.ok{background:#ecfdf3;color:#05603a}.access-banner.expired{background:#fef3f2;color:#912018}.access-banner a{color:inherit;font-weight:800}.auth-shell{max-width:520px;margin:54px auto}.auth-card{background:white;padding:28px;border-radius:14px;border:1px solid var(--line);box-shadow:var(--shadow)}.auth-card .brand-center{text-align:center;margin-bottom:24px}.auth-card .brand-center .brand-mark{margin:0 auto 10px;color:#fff}.stack{display:flex;flex-direction:column;gap:14px}.auth-links{text-align:center;margin-top:16px}.empty{text-align:center;padding:36px;color:var(--muted)}.stock-bar{height:8px;background:#eef2f6;border-radius:999px;overflow:hidden;min-width:80px}.stock-bar span{display:block;height:100%;background:var(--accent)}.list-clean{list-style:none;padding:0;margin:0}.list-clean li{padding:10px 0;border-bottom:1px solid var(--line)}.list-clean li:last-child{border-bottom:0}.plans{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;max-width:850px;margin:24px auto}.plan{position:relative}.plan.featured{border:2px solid var(--accent)}.plan-price{font-size:36px;font-weight:800}.plan-price small{font-size:14px;color:var(--muted)}.save{display:inline-block;background:#ecfdf3;color:#067647;font-weight:800;border-radius:999px;padding:5px 9px;font-size:12px}.footer{text-align:center;color:var(--muted);font-size:12px;padding:22px}.report-summary{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:16px}.report-summary .badge{font-size:13px;padding:7px 10px}.text-danger{color:var(--red);font-weight:700}.text-success{color:var(--green);font-weight:700}.nowrap{white-space:nowrap}@media(max-width:900px){.grid.cards{grid-template-columns:repeat(2,1fr)}.two-col{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.plans{grid-template-columns:1fr}}@media(max-width:560px){.topbar{align-items:flex-start;flex-direction:column}.top-user{width:100%;justify-content:space-between}.grid.cards{grid-template-columns:1fr}.container{padding:0 12px;margin-top:16px}.page-head{flex-direction:column}.actions{width:100%}.actions .btn{flex:1}.auth-shell{margin:20px auto}.plans{margin-top:14px}}
@media print{.topbar,.nav,.access-banner,.actions,.filters,.footer,.alert{display:none!important}.container{max-width:none;margin:0;padding:0}.card,.table-wrap{box-shadow:none;border:0}body{background:white;font-size:11px}table{min-width:0}th,td{padding:7px}.print-title{display:block!important}}
.input-with-action{display:flex;align-items:stretch;gap:8px}.input-with-action select{min-width:0}.ellipsis-button{flex:0 0 46px;padding:10px 8px;font-size:18px;line-height:1}.modal-dialog{width:min(680px,calc(100vw - 28px));max-height:calc(100vh - 40px);border:0;border-radius:14px;padding:0;box-shadow:0 24px 70px rgba(16,24,40,.28);color:var(--text)}.modal-dialog::backdrop{background:rgba(16,24,40,.58)}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 22px 12px;border-bottom:1px solid var(--line)}.modal-head h2{margin-bottom:4px}.modal-head .subtle{margin-bottom:0}.modal-close{border:0;background:transparent;color:#667085;font-size:30px;line-height:1;cursor:pointer;padding:0 4px}.modal-dialog>.alert{margin:16px 22px 0}.department-form{display:flex;gap:12px;align-items:end;padding:18px 22px;border-bottom:1px solid var(--line)}.department-form .field{margin:0}.department-list{padding:8px 22px 22px;max-height:340px;overflow:auto}.department-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-bottom:1px solid var(--line)}.department-row:last-child{border-bottom:0}.department-row .actions{justify-content:flex-end}.empty.compact{padding:20px 0;margin:0}@media(max-width:560px){.department-form{align-items:stretch;flex-direction:column}.department-form .actions{width:100%}.department-row{align-items:flex-start;flex-direction:column}.department-row .actions{width:100%}.department-row .actions .btn{flex:1}}
/* Ajuda e manual rápido */
.help-page-head{align-items:center}.help-search-card{background:linear-gradient(135deg,#101828,#1d2939);color:#fff;border-radius:14px;padding:20px 22px;margin-bottom:20px;box-shadow:var(--shadow)}.help-search-card label{display:block;font-weight:800;margin-bottom:9px}.help-search-row{display:flex;gap:10px}.help-search-row input{flex:1;min-width:0;border:1px solid #475467;border-radius:9px;padding:12px 13px;font:inherit}.help-search-card .subtle{color:#d0d5dd;margin:9px 0 0}.help-layout{display:grid;grid-template-columns:250px minmax(0,1fr);gap:20px;align-items:start}.help-sidebar{position:sticky;top:16px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:16px;box-shadow:var(--shadow);max-height:calc(100vh - 32px);overflow:auto}.help-sidebar>strong{display:block;margin-bottom:10px;font-size:13px;text-transform:uppercase;letter-spacing:.05em;color:#475467}.help-sidebar nav{display:flex;flex-direction:column;gap:3px}.help-sidebar a{color:#344054;text-decoration:none;border-radius:7px;padding:8px 10px;font-size:13px}.help-sidebar a:hover,.help-sidebar a.active{background:#eff8ff;color:#175cd3;font-weight:700}.help-content{min-width:0}.help-topic{scroll-margin-top:18px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:22px;margin-bottom:18px;box-shadow:var(--shadow)}.help-topic[hidden]{display:none}.help-topic-title{display:flex;gap:13px;align-items:flex-start;margin-bottom:16px}.help-topic-title h2{margin:0 0 3px}.help-topic-title p{margin:0;color:var(--muted)}.help-topic-number{flex:0 0 34px;height:34px;border-radius:9px;display:grid;place-items:center;background:#eff8ff;color:#175cd3;font-weight:800}.help-topic h3{margin:24px 0 10px;font-size:17px}.help-topic h3:first-of-type{margin-top:14px}.help-image-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.help-figure{margin:0 0 18px}.help-figure img{display:block;width:100%;height:auto;border:1px solid var(--line);border-radius:10px;background:#f9fafb}.help-figure figcaption{font-size:12px;color:var(--muted);margin-top:7px;text-align:center}.help-table-wrap{overflow:auto;border:1px solid var(--line);border-radius:10px}.help-field-table{min-width:760px;box-shadow:none}.help-field-table th{white-space:nowrap}.help-field-table td{font-size:13px;line-height:1.45;vertical-align:top}.help-steps{padding-left:22px;margin:0}.help-steps li{margin:9px 0;line-height:1.5}.help-callout{margin-top:16px;padding:13px 15px;border-radius:9px;border-left:4px solid}.help-callout.info{background:#eff8ff;color:#1849a9;border-left-color:#2e90fa}.help-callout.warning{background:#fff6ed;color:#9c2a10;border-left-color:#f79009}.help-no-results{background:#fff;border:1px dashed #98a2b3;border-radius:12px;padding:40px;text-align:center;color:var(--muted)}.help-no-results h2{color:var(--text)}
@media(max-width:980px){.help-layout{grid-template-columns:1fr}.help-sidebar{position:static;max-height:none}.help-sidebar nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.help-sidebar a{border:1px solid var(--line)}}
@media(max-width:680px){.help-search-row{flex-direction:column}.help-image-grid{grid-template-columns:1fr}.help-sidebar nav{grid-template-columns:repeat(2,minmax(0,1fr))}.help-topic{padding:16px}.help-topic-title{gap:9px}.help-topic-number{flex-basis:30px;height:30px}.help-page-head .actions .btn{width:100%}}
@media(max-width:430px){.help-sidebar nav{grid-template-columns:1fr}}
@media print{.help-search-card,.help-sidebar{display:none!important}.help-layout{display:block}.help-topic{break-inside:avoid;box-shadow:none}.help-figure{max-width:700px}.help-content{width:100%}}

/* Empresa e logótipo */
.brand-logo-shell{width:60px;height:60px;border-radius:10px;background:#fff;display:grid;place-items:center;overflow:hidden;padding:4px;flex:0 0 60px}.brand-company-logo{display:block;max-width:100%;max-height:100%;object-fit:contain}.company-settings-grid{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:18px;align-items:start}.company-details{margin:0}.company-details>div{display:grid;grid-template-columns:120px 1fr;gap:14px;padding:11px 0;border-bottom:1px solid var(--line)}.company-details>div:last-child{border-bottom:0}.company-details dt{font-weight:700;color:#475467}.company-details dd{margin:0}.company-logo-preview{height:170px;border:2px dashed #d0d5dd;border-radius:12px;background:#f9fafb;display:grid;place-items:center;color:var(--muted);padding:16px;overflow:hidden}.company-logo-preview.has-logo{border-style:solid;background:#fff}.company-logo-preview img{display:block;max-width:100%;max-height:100%;object-fit:contain}.logo-file-info{text-align:right;margin:6px 0 0}.report-company-header{display:flex;align-items:center;justify-content:space-between;gap:24px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:16px 18px;margin-bottom:18px;box-shadow:var(--shadow)}.report-company-identity{display:flex;align-items:center;gap:14px;min-width:0}.report-company-identity>div{display:flex;flex-direction:column;gap:2px}.report-company-identity strong{font-size:17px}.report-company-identity span{color:var(--muted);font-size:12px}.report-company-logo{display:block;width:auto;height:auto;max-width:210px;max-height:66px;object-fit:contain}.report-logo-placeholder{width:52px;height:52px;border-radius:10px;background:var(--accent);color:#fff!important;display:grid;place-items:center;font-size:26px!important;font-weight:800}.report-company-meta{display:flex;flex-direction:column;align-items:flex-end;text-align:right;gap:2px}.report-company-meta span{font-size:12px;color:var(--muted)}
@media(max-width:800px){.company-settings-grid{grid-template-columns:1fr}.report-company-header{align-items:flex-start;flex-direction:column}.report-company-meta{align-items:flex-start;text-align:left}}
@media print{.report-company-header + .page-head{display:none!important}.report-company-header{display:flex!important;border:0;border-bottom:1px solid #98a2b3;border-radius:0;box-shadow:none;padding:0 0 12px;margin-bottom:14px}.report-company-logo{max-width:190px;max-height:58px}.report-company-meta span{color:#475467}.report-logo-placeholder{-webkit-print-color-adjust:exact;print-color-adjust:exact}}


/* Correção defensiva do logótipo: impede que uma imagem aumente o cabeçalho. */
/* Logótipo maior no cabeçalho, com dimensões adaptadas ao ecrã. */
.topbar{min-height:80px;overflow:hidden}.brand{min-width:0}.brand-logo-shell{width:60px!important;height:60px!important;max-width:60px!important;max-height:60px!important;flex:0 0 60px!important;overflow:hidden!important}.brand-company-logo{display:block!important;width:auto!important;height:auto!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important}.logo-settings-card form{position:relative;z-index:1}
@media(max-width:900px){.topbar{min-height:68px!important}.brand-logo-shell{width:48px!important;height:48px!important;max-width:48px!important;max-height:48px!important;flex-basis:48px!important}}
@media(max-width:560px){.topbar{min-height:auto!important}.brand-logo-shell{width:42px!important;height:42px!important;max-width:42px!important;max-height:42px!important;flex-basis:42px!important}}

/* Login, idioma e cabeçalho melhorados */
.topbar{min-height:88px;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.topbar-right{display:flex;align-items:center;gap:16px;flex-wrap:wrap;justify-content:flex-end}.app-logo-shell{background:#fff}.lang-switcher{display:inline-flex;align-items:center;gap:6px;background:#fff;border:1px solid #d0d5dd;border-radius:999px;padding:5px;box-shadow:var(--shadow)}.lang-switcher.compact{margin-left:auto}.lang-pill{display:inline-flex;align-items:center;justify-content:center;min-width:42px;height:38px;padding:0 12px;border-radius:999px;text-decoration:none;color:#344054;font-weight:800;font-size:14px}.lang-pill.active{background:var(--accent);color:#fff}.auth-card-large{max-width:760px;margin:0 auto;padding:30px 36px}.auth-card-top{display:flex;justify-content:flex-end;margin-bottom:10px}.auth-brand-center{text-align:center}.auth-brand-logo{display:block;max-width:360px;width:100%;height:auto;margin:0 auto 18px}.auth-actions-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:8px}.auth-actions-row.single{grid-template-columns:1fr}.auth-btn{min-height:52px;font-size:16px;border-radius:10px}.btn.success{background:#1d9b5f}.btn.success:hover{background:#168653}.auth-links{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}.auth-links a{font-weight:700;text-decoration:none}
@media(max-width:700px){.auth-card-large{padding:24px 18px}.auth-brand-logo{max-width:300px}.auth-actions-row{grid-template-columns:1fr}.lang-switcher{width:100%;justify-content:center}.topbar-right{width:100%;justify-content:space-between}}

/* Registo e edição da morada da empresa */
.company-register-grid{gap:14px}.postal-status{display:block;min-height:18px}.postal-status.loading{color:#175cd3}.postal-status.success{color:#067647;font-weight:700}.postal-status.error{color:#b42318}.company-settings-grid .form-grid{margin:0}
@media(max-width:700px){.company-register-grid{grid-template-columns:1fr}.company-register-grid .full{grid-column:auto}}
