/* O Meu Arquivo. Isolado do restante visual do site. */
#my-archive-button{background:#fffdf8;border:1px solid #b8cbbd;border-radius:999px;padding:9px 15px;color:#22523e;font-weight:650;white-space:nowrap}
#my-archive-button:hover{background:#ecf3eb}
#save-person{border:1px solid #bbcdbf;border-radius:999px;padding:8px 12px;background:#fffaf0;color:#295c4a;font-weight:700;white-space:nowrap}
#save-person.ma-starred{color:#835f2c;background:#fff2d7;border-color:#e3cea5}
.ma-dialog{border:1px solid #d6e0d5;border-radius:19px;box-shadow:0 22px 78px #112c2340;background:#fdfbf6;color:#203e34;padding:0;max-width:min(1020px,calc(100vw - 24px));width:100%;max-height:min(94dvh,1000px);overflow:auto}
.ma-dialog::backdrop{background:rgba(11,34,29,.7);backdrop-filter:blur(3px)}
.ma-layout{padding:0 0 16px}
.ma-header{background:#173e34;color:#fffdf7;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:30px 34px;border-radius:18px 18px 0 0}
.ma-header h2{font:normal clamp(28px,4vw,41px)/1.15 Georgia,serif;margin:5px 0 8px;color:#fffdf7}
.ma-header p{margin:0;color:#dfede0}
.ma-overline{font-size:10px;font-weight:750;letter-spacing:.16em;text-transform:uppercase;margin:0;color:#b5d5bc}
.ma-header .ma-icon{color:#fffdf7;background:#ffffff22;border:1px solid #ffffff4d}
.ma-icon{min-width:35px;min-height:35px;padding:6px 9px;border:1px solid #c8d5ca;border-radius:9px;background:#fffdf8;color:#476554;display:inline-flex;justify-content:center;align-items:center;font-weight:bold}
.ma-body{padding:26px 34px}
.ma-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:22px}
.ma-stats>div{background:#f3f6ee;border:1px solid #dce6d9;border-radius:12px;padding:13px 17px;display:flex;flex-direction:column;gap:4px}
.ma-stats strong{font:normal 29px Georgia,serif;color:#184535}
.ma-stats span{font-size:12px;color:#607b6d}
.ma-tabs{display:flex;gap:7px;border-bottom:1px solid #d6e1d8;margin:0 0 18px;padding:0 0 8px;flex-wrap:wrap}
.ma-tabs button{border:0;background:transparent;color:#5b6f60;padding:9px 13px;border-radius:9px;font-weight:600}
.ma-tabs button.active{background:#215441;color:#fffdf7}
.ma-caption{font-size:13px;color:#64766e;line-height:1.6;margin:12px 0}
.ma-toolbar{display:flex;justify-content:space-between;align-items:flex-end;gap:15px;flex-wrap:wrap;margin:14px 0 20px}
.ma-search-label{font-size:12px;color:#476756;display:flex;flex-direction:column;gap:6px;flex:1;min-width:190px}
.ma-search-label input,.ma-edit-dialog input:not([type=checkbox]),.ma-edit-dialog select,.ma-edit-dialog textarea{font:inherit;color:#223e34;padding:11px 13px;border:1px solid #bacdbf;border-radius:10px;width:100%;background:#fff}
.ma-search-label input:focus,.ma-edit-dialog input:focus,.ma-edit-dialog textarea:focus{outline:2px solid #6c947e;outline-offset:1px}
.ma-primary{background:#205740!important;color:#fff!important;border:1px solid #205740!important;border-radius:9px!important;font-weight:650;padding:10px 15px}
.ma-primary:hover{background:#173e34!important}
.ma-result-heading{display:flex;align-items:baseline;justify-content:space-between;gap:15px;margin:12px 0}
.ma-result-heading strong{font:normal 21px Georgia,serif;color:#204a39}
.ma-result-heading small,.ma-collections-title small{color:#67766b;font-size:12px}
.ma-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.ma-card{border:1px solid #d9e2d8;background:#fff;border-radius:12px;padding:18px;display:flex;flex-direction:column;gap:12px;min-width:0}
.ma-card-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;flex-wrap:wrap}
.ma-card h3{font:normal 20px/1.3 Georgia,serif;margin:0;color:#244a3b;overflow-wrap:anywhere}
.ma-card-detail{color:#6c7b72;font-size:11px;margin:6px 0 0;overflow-wrap:anywhere}
.ma-state{font-size:11px;font-weight:700;color:#616d52;background:#f2f4e8;border-radius:30px;padding:5px 9px;white-space:nowrap}
.ma-state.por_confirmar{background:#fff1d8;color:#916027}
.ma-state.em_investigacao{background:#e8f1ff;color:#315f91}
.ma-state.concluido{background:#e2f1e9;color:#316a49}
.ma-note-preview{color:#52685d;font-size:13px;background:#f8f8f2;padding:12px;border-left:3px solid #a7c4b0;white-space:pre-line;margin:0;overflow-wrap:anywhere}
.ma-chips{display:flex;gap:5px;flex-wrap:wrap}
.ma-chip{display:inline-block;background:#f2f4ee;border:1px solid #dde6d9;border-radius:999px;padding:4px 9px;font-size:11px;color:#526f5a}
.ma-card-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:auto}
.ma-card-actions button{font-size:12px;border-radius:9px;padding:8px 12px}
.ma-empty{padding:37px 15px;text-align:center;background:#f5f6ef;border:1px dashed #cbd8c9;border-radius:12px;color:#607366}
.ma-empty span{font-size:43px;color:#a8b99b}
.ma-empty h3{font:normal 23px Georgia,serif;color:#325745;margin:8px 0}
.ma-empty p{font-size:13px;max-width:480px;margin:0 auto}
.ma-feedback{margin:0 34px;min-height:1.3em;color:#3e6a47;font-size:13px}
.ma-feedback[data-type=error]{color:#963d37}
.ma-collections{background:#f6f7f1;border:1px solid #dee7db;border-radius:12px;padding:15px 17px;margin:10px 0 19px}
.ma-collections-title{display:flex;justify-content:space-between;gap:10px;margin-bottom:10px;flex-wrap:wrap}
.ma-collection-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.ma-folder-row{display:flex;align-items:center;gap:6px;min-width:0;padding-left:calc(var(--ma-depth)*12px)}
.ma-folder{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #dbe5d8;background:#fffdf9;border-radius:9px;padding:9px 11px;flex:1;min-width:0;text-align:left;color:#365743;font-size:13px}
.ma-folder span{overflow-wrap:anywhere}
.ma-folder small{color:#748578}
.ma-folder.active{border-color:#376c52;background:#e9f1e9;font-weight:bold}
.ma-folder-row .ma-icon{min-width:29px;min-height:29px;padding:4px}
.ma-status-filters{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:18px}
.ma-status-filters button{font-size:12px;padding:8px 12px;border:1px solid #d5e1d6;border-radius:999px}
.ma-status-filters button.active{background:#205740;color:white;border-color:#205740}
.ma-edit-dialog{max-width:min(650px,calc(100vw - 24px))}
.ma-editor-inner{padding:28px 30px}
.ma-editor-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;border-bottom:1px solid #e1e6dd;padding-bottom:17px;margin-bottom:22px}
.ma-editor-heading h2{font:normal 27px Georgia,serif;margin:5px 0 5px;color:#1a4c39}
.ma-editor-heading p:not(.ma-overline){color:#728176;font-size:12px;margin:0}
.ma-edit-dialog form>label{display:flex;flex-direction:column;gap:7px;font-size:13px;color:#345746;margin-bottom:17px;font-weight:600}
.ma-edit-dialog textarea{resize:vertical;min-height:100px;font-weight:400}
.ma-edit-dialog select{font-weight:400}
.ma-edit-dialog fieldset{border:1px solid #d7e2d6;padding:12px 15px;border-radius:11px;margin:0}
.ma-edit-dialog legend{font-size:13px;font-weight:700;color:#355945;padding:0 6px}
.ma-checkbox-list{max-height:170px;overflow:auto;display:grid;gap:5px}
.ma-checkbox-list label{display:flex;align-items:center;gap:8px;padding:5px 0 5px calc(var(--ma-depth)*16px);font-size:13px;color:#456250}
.ma-checkbox-list input{accent-color:#275b45;min-width:17px;min-height:17px}
.ma-editor-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:20px}
.ma-editor-actions span{flex:1}
.ma-editor-actions button{font-size:12px;padding:9px 12px}
.ma-danger{color:#963f38;background:#fff3f1;border:1px solid #e6c8c5;border-radius:9px}
#ma-editor-error,#ma-folder-error{font-size:12px;color:#ad3737}
@media(max-width:670px){
 .ma-dialog{max-width:calc(100vw - 12px);max-height:96dvh}
 .ma-header{padding:22px 19px}
 .ma-body{padding:18px 15px}
 .ma-stats{gap:7px}
 .ma-stats>div{padding:11px 7px}
 .ma-stats strong{font-size:25px}
 .ma-stats span{font-size:10px}
 .ma-items,.ma-collection-list{grid-template-columns:minmax(0,1fr)}
 .ma-card{padding:14px}
 .ma-toolbar{align-items:stretch}
 .ma-new-collection{width:100%}
 .ma-editor-inner{padding:20px 17px}
 .ma-edit-dialog{width:calc(100vw - 12px)}
 .ma-feedback{margin:0 15px}
 #save-person{padding:7px 9px;font-size:12px}
}


/* Accessible dark palette for O Meu Arquivo, 2026-10-31 */
html[data-theme="dark"] #my-archive-button,
html[data-theme="dark"] #save-person{
 background:#253b2d;color:#d5ead9;border-color:#52745a;
}
html[data-theme="dark"] #save-person.ma-starred{
 background:#57472c;color:#ffdf99;border-color:#907047;
}
html[data-theme="dark"] .ma-dialog{
 background:#18271f;color:#e4f0e5;border-color:#45614c;
}
html[data-theme="dark"] .ma-header{background:#213b2c;color:#e9f3e9;border-color:#47684e}
html[data-theme="dark"] .ma-header h2{color:#f1f5e9}
html[data-theme="dark"] .ma-header p{color:#c1d7c6}
html[data-theme="dark"] .ma-overline{color:#a8d3b3}
html[data-theme="dark"] :is(.ma-stats>div,.ma-card,.ma-collections,.ma-empty,.ma-folder,.ma-note-preview){
 background:#23372a;color:#e4efe6;border-color:#455e4b;
}
html[data-theme="dark"] .ma-card h3,
html[data-theme="dark"] .ma-result-heading strong,
html[data-theme="dark"] .ma-editor-heading h2,
html[data-theme="dark"] .ma-empty h3,
html[data-theme="dark"] .ma-stats strong{color:#e5f1e8}
html[data-theme="dark"] :is(.ma-card-detail,.ma-result-heading small,.ma-collections-title small,.ma-search-label,.ma-caption,.ma-stats span,.ma-folder small,.ma-editor-heading p:not(.ma-overline)){color:#abc4b1}
html[data-theme="dark"] .ma-tabs{border-color:#46614c}
html[data-theme="dark"] .ma-tabs button{color:#bad6c0}
html[data-theme="dark"] .ma-tabs button.active,
html[data-theme="dark"] .ma-status-filters button.active{background:#326e4c;color:#fff;border-color:#5c9671}
html[data-theme="dark"] .ma-card .ma-state{background:#364733;color:#e0eac8}
html[data-theme="dark"] .ma-card .ma-state.por_confirmar{background:#55452b;color:#f4d99e}
html[data-theme="dark"] .ma-card .ma-state.em_investigacao{background:#293e57;color:#b7d8f7}
html[data-theme="dark"] .ma-card .ma-state.concluido{background:#2a513b;color:#bde4ca}
html[data-theme="dark"] .ma-note-preview{border-left-color:#8eb79a;color:#d3e6d9}
html[data-theme="dark"] .ma-chip{background:#2d4934;color:#c6e5cf;border-color:#4d6955}
html[data-theme="dark"] :is(.ma-icon,.ma-folder-row .ma-icon,.ma-status-filters button:not(.active)){
 background:#2a4332;color:#d9eddd;border-color:#53725b;
}
html[data-theme="dark"] .ma-folder.active{background:#365642;color:#f0f6ec;border-color:#8ab895}
html[data-theme="dark"] .ma-edit-dialog .ma-editor-heading,
html[data-theme="dark"] .ma-edit-dialog fieldset{border-color:#4e6a55}
html[data-theme="dark"] .ma-edit-dialog :is(form>label,legend,.ma-checkbox-list label){color:#d6e8d8}
html[data-theme="dark"] .ma-edit-dialog :is(input:not([type="checkbox"]),textarea,select),
html[data-theme="dark"] .ma-search-label input{
 background:#16261c;color:#e7f2e7;border-color:#52715a;
}
html[data-theme="dark"] .ma-danger{background:#51302d;color:#ffccc4;border-color:#945550}
html[data-theme="dark"] #ma-editor-error,
html[data-theme="dark"] #ma-folder-error,
html[data-theme="dark"] .ma-feedback[data-type="error"]{color:#ffb1a6}
html[data-theme="dark"] .ma-feedback{color:#afdbb9}


.ma-tag{display:inline-flex;align-items:center;border-radius:999px;padding:4px 10px;font-size:.8rem;font-weight:600;line-height:1.5;overflow-wrap:anywhere;max-width:100%}
.ma-profile-tags{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:12px 0;border-bottom:1px solid #dce3da}
.ma-profile-tags .ma-chips{margin:0}.ma-profile-tags button{border:1px solid #c6d5c8;border-radius:999px;padding:6px 12px;background:#fafbf6;color:#245b46}
.ma-tag-filter{display:grid;gap:6px;margin:12px 0;max-width:300px}.ma-tag-filter select{padding:9px;border:1px solid #c6d5c8;border-radius:8px;background:#fff}
.ma-tag-list{display:grid;gap:8px;margin:16px 0}.ma-tag-list>div{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.ma-tag-list .ma-tag{margin-right:auto}
.ma-tag-suggestions{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}.ma-tag-suggestions button{border:0;background:transparent;padding:0}.ma-tag-suggestions button:focus-visible{outline:2px solid #245b46;outline-offset:3px;border-radius:999px}
.ma-edit-dialog input[type=color]{width:80px;height:44px;padding:3px}.ma-tag-list button{border:1px solid #c6d5c8;border-radius:8px;background:#fff;padding:6px 10px}
@media(max-width:600px){.ma-tabs{flex-wrap:wrap}.ma-profile-tags{gap:6px}.ma-tag-filter{max-width:none}}

/* Paleta predefinida de etiquetas */
.ma-palette{border:0;padding:0;margin:12px 0 16px;min-width:0}
.ma-palette legend{font-weight:650;margin-bottom:9px}
.ma-palette-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px}
.ma-palette-option{display:flex!important;flex-direction:row!important;align-items:center;gap:7px;cursor:pointer;padding:8px!important;border:1px solid #d1ddd2;border-radius:10px;background:#fff}
.ma-palette-option:has(input:checked){border-color:#23563e;box-shadow:0 0 0 2px #23563e30;background:#f1f6f0}
.ma-palette-option input{accent-color:#245b46;width:15px;height:15px;flex:none}
.ma-palette-swatch{display:inline-block!important;width:19px;height:19px;flex:none;border-radius:50%;border:1px solid #0002}
@media(max-width:600px){.ma-palette-options{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Corrige a regra global de inputs que estava a expandir os radios da paleta. */
.ma-edit-dialog .ma-palette{min-width:0;width:100%;box-sizing:border-box;overflow:hidden}
.ma-edit-dialog .ma-palette-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:100%;min-width:0}
.ma-edit-dialog .ma-palette-option{display:flex!important;min-width:0;width:auto;box-sizing:border-box;gap:7px;justify-content:flex-start;overflow:hidden;font-size:12px;white-space:nowrap}
.ma-edit-dialog .ma-palette-option input[type="radio"]{appearance:auto!important;display:block!important;width:15px!important;min-width:15px!important;max-width:15px!important;height:15px!important;min-height:15px!important;padding:0!important;margin:0!important;border:0!important;box-shadow:none!important;flex:0 0 15px!important;accent-color:#245b46}
.ma-edit-dialog .ma-palette-swatch{display:block!important;min-width:18px!important;width:18px!important;height:18px!important;padding:0!important;margin:0!important;border-radius:50%!important;flex:0 0 18px!important}
.ma-edit-dialog .ma-palette-option>span:last-child{overflow:hidden;text-overflow:ellipsis}
@media(max-width:640px){.ma-edit-dialog .ma-palette-options{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Um único círculo de cor por opção; o rádio permanece acessível por teclado. */
.ma-edit-dialog .ma-palette-option{position:relative!important;display:flex!important;align-items:center!important;gap:9px!important;cursor:pointer!important}
.ma-edit-dialog .ma-palette-option input[type="radio"]{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-width:none!important;min-width:0!important;opacity:0!important;margin:0!important;cursor:pointer!important;z-index:1}
.ma-edit-dialog .ma-palette-option .ma-palette-swatch{position:relative!important;display:inline-block!important;width:20px!important;height:20px!important;min-width:20px!important;flex:0 0 20px!important;border:2px solid #ffffff!important;outline:1px solid #64766a!important;border-radius:50%!important}
.ma-edit-dialog .ma-palette-option:has(input:checked){border-color:#245b46!important;background:#edf5ed!important;box-shadow:0 0 0 2px #245b4633!important}
.ma-edit-dialog .ma-palette-option:has(input:checked) .ma-palette-swatch{outline:2px solid #163f30!important;outline-offset:2px!important}
.ma-edit-dialog .ma-palette-option:has(input:focus-visible){outline:2px solid #245b46!important;outline-offset:2px!important}

/* Círculos de cor Unicode: não dependem de regras de background globais. */
.ma-edit-dialog .ma-palette-option .ma-palette-emoji{display:inline-block!important;font-size:19px!important;line-height:1!important;flex:0 0 22px!important;text-align:center!important;opacity:1!important}
.ma-edit-dialog .ma-palette-option input[type=radio]{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;opacity:0!important;cursor:pointer!important}

/* Etiquetas nas fichas individuais: mesmo aspeto das etiquetas nos resultados. */
#ma-profile-tags .ma-chips>.ma-tag{display:inline-flex!important;align-items:center!important;border-radius:999px!important;padding:3px 9px!important;font-size:11px!important;font-weight:650!important;line-height:1.4!important;white-space:nowrap!important;box-shadow:0 1px 2px rgba(0,0,0,.08)!important;background-image:none!important;opacity:1!important}

/* Cores em classes estáticas para respeitar a Content Security Policy (sem style inline). */
#ma-profile-tags .ma-tag.ma-color-d32f2f,#archive .ma-tag.ma-color-d32f2f,.ma-dialog .ma-tag.ma-color-d32f2f{background-color:#D32F2F!important;background-image:none!important;border:1px solid #D32F2F!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-f57c00,#archive .ma-tag.ma-color-f57c00,.ma-dialog .ma-tag.ma-color-f57c00{background-color:#F57C00!important;background-image:none!important;border:1px solid #F57C00!important;color:#14251f!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-fbc02d,#archive .ma-tag.ma-color-fbc02d,.ma-dialog .ma-tag.ma-color-fbc02d{background-color:#FBC02D!important;background-image:none!important;border:1px solid #FBC02D!important;color:#14251f!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-2e7d32,#archive .ma-tag.ma-color-2e7d32,.ma-dialog .ma-tag.ma-color-2e7d32{background-color:#2E7D32!important;background-image:none!important;border:1px solid #2E7D32!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-1565c0,#archive .ma-tag.ma-color-1565c0,.ma-dialog .ma-tag.ma-color-1565c0{background-color:#1565C0!important;background-image:none!important;border:1px solid #1565C0!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-7b1fa2,#archive .ma-tag.ma-color-7b1fa2,.ma-dialog .ma-tag.ma-color-7b1fa2{background-color:#7B1FA2!important;background-image:none!important;border:1px solid #7B1FA2!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-7951a0,#archive .ma-tag.ma-color-7951a0,.ma-dialog .ma-tag.ma-color-7951a0{background-color:#7951a0!important;background-image:none!important;border:1px solid #7951a0!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-387aa0,#archive .ma-tag.ma-color-387aa0,.ma-dialog .ma-tag.ma-color-387aa0{background-color:#387aa0!important;background-image:none!important;border:1px solid #387aa0!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-3e7a54,#archive .ma-tag.ma-color-3e7a54,.ma-dialog .ma-tag.ma-color-3e7a54{background-color:#3e7a54!important;background-image:none!important;border:1px solid #3e7a54!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-986c23,#archive .ma-tag.ma-color-986c23,.ma-dialog .ma-tag.ma-color-986c23{background-color:#986c23!important;background-image:none!important;border:1px solid #986c23!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-a36924,#archive .ma-tag.ma-color-a36924,.ma-dialog .ma-tag.ma-color-a36924{background-color:#a36924!important;background-image:none!important;border:1px solid #a36924!important;color:#14251f!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-a34b4b,#archive .ma-tag.ma-color-a34b4b,.ma-dialog .ma-tag.ma-color-a34b4b{background-color:#a34b4b!important;background-image:none!important;border:1px solid #a34b4b!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-65758b,#archive .ma-tag.ma-color-65758b,.ma-dialog .ma-tag.ma-color-65758b{background-color:#65758b!important;background-image:none!important;border:1px solid #65758b!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-245b46,#archive .ma-tag.ma-color-245b46,.ma-dialog .ma-tag.ma-color-245b46{background-color:#245b46!important;background-image:none!important;border:1px solid #245b46!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-d81b60,#archive .ma-tag.ma-color-d81b60,.ma-dialog .ma-tag.ma-color-d81b60{background-color:#D81B60!important;background-image:none!important;border:1px solid #D81B60!important;color:#ffffff!important;opacity:1!important}
#ma-profile-tags .ma-tag.ma-color-00838f,#archive .ma-tag.ma-color-00838f,.ma-dialog .ma-tag.ma-color-00838f{background-color:#00838F!important;background-image:none!important;border:1px solid #00838F!important;color:#14251f!important;opacity:1!important}
