*{box-sizing:border-box}
:root{
 --blue:#405189;--green:#22a06b;--sky:#6ec8ff;--yellow:#f6c945;
 --orange:#f7b84b;--red:#f06548;--bg:#f3f6fa;--border:#e5eaf1;
 --text:#172033;--muted:#8492a6;--soft:#f8f9fc
}
body{margin:0;background:var(--bg);color:var(--text);font-family:Arial,sans-serif}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.app{max-width:1550px;margin:auto;padding:22px}
.top{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:16px}
.brand{display:flex;gap:12px;align-items:center}
.logo{width:46px;height:46px;border-radius:12px;background:var(--blue);color:#fff;display:grid;place-items:center;font-weight:800}
.brand h1{font-size:20px;margin:0}
.brand p{margin:4px 0 0;color:var(--muted);font-size:13px}
.daynav{display:flex;align-items:center;gap:7px;background:#fff;padding:6px;border:1px solid var(--border);border-radius:13px;flex-wrap:wrap}
.navbtn,.editbtn,.addbtn,.newday,.smallbtn{border:1px solid var(--border);background:#fff;border-radius:9px;min-height:38px;padding:0 12px;font-weight:700;color:#445}
.navbtn{width:40px;padding:0;font-size:20px}
.daynav input{border:0;outline:0;padding:7px;font-weight:700;color:var(--blue)}
.newday{border:0;background:var(--blue);color:#fff}
.grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(360px,.85fr);gap:16px}
.card{background:#fff;border:1px solid var(--border);border-radius:15px;overflow:hidden}
.summary{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:17px 19px}
.summary h2{font-size:16px;margin:0 0 5px}
.muted{color:var(--muted);font-size:12px}
.progress{height:7px;background:#edf0f5;border-radius:20px;margin-top:11px;overflow:hidden;min-width:250px}
.bar{height:100%;width:0;background:var(--green);transition:.2s}
.percent{font-size:27px;font-weight:800;color:var(--blue)}
.toolbar{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid var(--border);background:#fbfcfe}
.tools{display:flex;gap:7px;flex-wrap:wrap}
.editbtn.active{background:#fff7e6;border-color:var(--orange);color:#9a6700}
.schedule{margin-top:14px}
.item{display:grid;grid-template-columns:92px 1fr auto;align-items:center;min-height:52px;border-bottom:1px solid #edf0f5}
.item:last-child{border-bottom:0}
.time{align-self:stretch;display:flex;align-items:center;justify-content:center;background:var(--soft);color:var(--blue);font-weight:800;font-size:13px;border-right:1px solid #edf0f5;padding:8px;text-align:center}
.content{min-width:0;padding:8px 13px}
.checkrow{display:grid;grid-template-columns:auto auto 1fr auto;align-items:center;gap:10px}
.taskcheck{width:20px;height:20px;accent-color:var(--green)}
.text{line-height:1.35}
.done .text{text-decoration:line-through;color:#98a4b3}
.na .text{color:#a07a00;font-style:italic}
.level1 .text{font-weight:800;color:#26345d}
.level2 .content{padding-left:32px}
.level3 .content{padding-left:58px}
.level3 .text{font-size:13px;color:#58677c}
.levelmark{font-size:9px;font-weight:800;padding:3px 6px;border-radius:12px;background:#eef1f8;color:#647096}
.status{border:1px solid var(--border);background:#fff;border-radius:7px;height:31px;padding:0 6px;font-size:11px}
.status.pending{color:#667085}
.status.done{color:var(--green);border-color:#bde6d5}
.status.na{color:#9a6700;border-color:#f6df96}
.editcontrols{display:none;align-items:center;gap:5px;padding-right:8px;flex-wrap:wrap}
.editing .editcontrols{display:flex}
.levelselect,.timeedit{border:1px solid var(--border);background:#fff;border-radius:7px;height:31px;padding:0 5px;font-size:11px}
.timeedit{width:76px}
.textedit{border:1px solid transparent;border-radius:6px;padding:5px;width:100%;background:transparent}
.editing .textedit{border-color:#dce2ea;background:#fff}
.mini{border:1px solid var(--border);background:#fff;border-radius:7px;min-width:31px;height:31px}
.mini.del{color:var(--red)}
.notice{display:none;margin-top:14px;background:#fff;border:1px dashed #cfd7e3;border-radius:15px;padding:45px 20px;text-align:center}
.side{padding:18px}
.side h2{font-size:17px;margin:0 0 4px}
.field{margin-top:13px}
.field label{display:block;font-size:10px;font-weight:800;color:#64748b;margin-bottom:6px}
textarea,input[type=text],select.sigselect{width:100%;border:1px solid #dfe5ed;border-radius:9px;padding:10px;outline:none;background:#fff}
textarea{min-height:90px;resize:vertical}
.twocol{display:grid;grid-template-columns:1fr 110px;gap:9px}
.saveincident{width:100%;border:0;background:var(--blue);color:#fff;border-radius:9px;padding:11px;margin-top:11px;font-weight:700}
.incident{border-top:1px solid #edf0f5;margin-top:16px;padding-top:13px}
.meta{display:flex;justify-content:space-between;align-items:center;font-size:11px;color:var(--muted)}
.badge{display:inline-flex;align-items:center;justify-content:center;min-width:30px;padding:3px 8px;border-radius:15px;font-weight:800;color:#17324d;border:1px solid transparent}
.badge.JB{background:#dff4e8;border-color:#9ad9b6;color:#1f6d49}
.badge.MZ{background:#def2ff;border-color:#9ed9ff;color:#24668e}
.badge.JS{background:#fff4b8;border-color:#f1d96e;color:#7b6500}
.incident p{font-size:13px;line-height:1.45;margin:7px 0;white-space:pre-wrap;overflow-wrap:anywhere}
.calendar{margin-top:18px;border-top:1px solid var(--border);padding-top:16px}
.calhead{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.calhead strong{font-size:14px}
.calgrid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.dow{text-align:center;font-size:10px;font-weight:800;color:var(--muted);padding:4px}
.day{min-height:66px;border:1px solid #edf0f5;border-radius:8px;padding:5px;background:#fff;text-align:left}
.day.other{opacity:.35}
.day.today{border-color:#9fb0d9}
.day.hasinc{background:#fbfdff}
.daynum{font-size:11px;font-weight:800;color:#58677c}
.badges{display:flex;gap:3px;flex-wrap:wrap;margin-top:5px}
.calbadge{border:0;padding:2px 5px;border-radius:10px;font-size:9px;font-weight:800}
.calbadge.JB{background:#dff4e8;color:#1f6d49}
.calbadge.MZ{background:#def2ff;color:#24668e}
.calbadge.JS{background:#fff4b8;color:#7b6500}
@media(max-width:980px){.grid{grid-template-columns:1fr}.top{align-items:flex-start;flex-direction:column}.daynav{width:100%}}
@media(max-width:700px){.app{padding:12px}.item{grid-template-columns:72px 1fr}.editcontrols{grid-column:2;padding:0 10px 8px}.checkrow{grid-template-columns:auto auto 1fr}.status{grid-column:3}.level2 .content{padding-left:20px}.level3 .content{padding-left:34px}.twocol{grid-template-columns:1fr}}

/* ART application additions */
.na .text{text-decoration:line-through}
.logoutform{margin:0}.logoutbtn{border:1px solid var(--border);background:#fff;border-radius:9px;min-height:38px;padding:0 12px;font-weight:700;color:#667085}
.flash{margin:0 0 14px;padding:10px 12px;border:1px solid #f1c0b6;background:#fff1ee;color:#9b3b29;border-radius:9px;font-size:13px}
.loginpage{min-height:100vh;display:grid;place-items:center;padding:20px}.logincard{width:min(420px,100%);background:#fff;border:1px solid var(--border);border-radius:16px;padding:24px;box-shadow:0 12px 35px #17203312}.loginbrand{display:flex;align-items:center;gap:12px;margin-bottom:20px}.loginbrand h1{font-size:19px;margin:0}.loginbrand p{margin:4px 0 0;color:var(--muted);font-size:12px}.passwordinput{width:100%;border:1px solid #dfe5ed;border-radius:9px;padding:11px;outline:none}.loginbtn{width:100%;border:0;background:var(--blue);color:#fff;border-radius:9px;padding:11px;margin-top:12px;font-weight:700}.saving{font-size:11px;color:var(--muted);min-width:70px;text-align:right}.saving.error{color:var(--red)}


/* R2: N/A and incident editing */
.na .taskcheck{accent-color:#111}
.incident-actions{display:flex;align-items:center;gap:7px}
.incident-edit{border:1px solid var(--border);background:#fff;border-radius:7px;padding:3px 8px;font-size:10px;font-weight:700;color:#596579}
.incidentformactions{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:end}
.cancelincident{display:none;border:1px solid var(--border);background:#fff;color:#596579;border-radius:9px;padding:11px 14px;margin-top:11px;font-weight:700}
.cancelincident.visible{display:block}

.reportfooter{display:flex;justify-content:flex-end;align-items:center;gap:10px;padding:12px 5px 4px;color:var(--muted);font-size:12px}
.reportfooter strong{font-size:20px;color:var(--blue)}

.replytemplates{margin-top:18px;border-top:1px solid var(--border);padding-top:16px}
.replytemplates h2{font-size:17px;margin:0 0 4px}
.replytemplates select{width:100%;border:1px solid #dfe5ed;border-radius:9px;padding:10px;background:#fff}
.replyactions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.copyreply{width:100%;border:1px solid var(--border);background:#fff;color:#405189;border-radius:9px;padding:11px;margin-top:11px;font-weight:700}
.replystatus{min-height:18px;margin-top:7px}
@media(max-width:700px){.replyactions{grid-template-columns:1fr}}

.richeditor{min-height:150px;width:100%;border:1px solid #dfe5ed;border-radius:9px;padding:10px;outline:none;background:#fff;line-height:1.45;overflow-wrap:anywhere}
.richeditor:empty:before{content:attr(data-placeholder);color:#9aa5b5;pointer-events:none}
.richeditor p{margin:0 0 8px}.richeditor p:last-child{margin-bottom:0}
.richeditor ul,.richeditor ol{margin:6px 0 8px 22px;padding:0}
.richeditor img{display:block;max-width:100%;height:auto;margin:10px 0;border-radius:6px}
.richeditor a{color:#405189;text-decoration:underline}
.personalizereply{grid-column:1/-1;width:100%;border:1px solid #bfc8dc;background:#f8f9fc;color:#405189;border-radius:9px;padding:10px;font-weight:700}
.replymodal[hidden]{display:none}.replymodal{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:24px}.replymodalbackdrop{position:absolute;inset:0;background:#1720338f}.replymodalcard{position:relative;width:min(980px,96vw);max-height:92vh;overflow:auto;background:#fff;border-radius:16px;border:1px solid var(--border);box-shadow:0 24px 70px #17203340;padding:20px}.replymodalhead{display:flex;justify-content:space-between;align-items:flex-start;gap:20px}.replymodalhead h2{margin:0 0 4px;font-size:20px}.replymodalclose{border:0;background:#f3f5f8;color:#4d5a70;width:38px;height:38px;border-radius:9px;font-size:26px;line-height:1}.richlarge{min-height:52vh;max-height:60vh;overflow:auto}.replymodalfoot{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:14px}.replymodalbuttons{display:flex;gap:8px}.replymodalbuttons .saveincident,.replymodalbuttons .copyreply{width:auto;min-width:160px;margin-top:0}.replymodal input[type=text]{width:100%;border:1px solid #dfe5ed;border-radius:9px;padding:10px;outline:none;background:#fff}
body.modalopen{overflow:hidden}
@media(max-width:700px){.replymodal{padding:8px}.replymodalcard{width:100%;max-height:97vh;padding:14px}.richlarge{min-height:55vh}.replymodalfoot{align-items:stretch;flex-direction:column}.replymodalbuttons{display:grid;grid-template-columns:1fr}.replymodalbuttons .saveincident,.replymodalbuttons .copyreply{width:100%}}
.richeditor table{border-collapse:collapse;max-width:100%;margin:8px 0}.richeditor td,.richeditor th{border:1px solid #dfe5ed;padding:5px 7px;vertical-align:top}

/* R6: day traffic status and destructive actions */
.summaryright{display:flex;align-items:center;gap:20px}
.daytraffic{display:flex;align-items:center;gap:8px;padding:5px 7px;border:1px solid var(--border);border-radius:20px;background:#fafbfd}
.trafficdot{width:18px;height:18px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #cfd6e2;opacity:.28;padding:0;transition:.15s transform,.15s opacity,.15s box-shadow}
.trafficdot.green{background:#22a06b}.trafficdot.yellow{background:#f6c945}.trafficdot.red{background:#f06548}
.trafficdot:hover{opacity:.7;transform:scale(1.08)}
.trafficdot.active{opacity:1;transform:scale(1.1);box-shadow:0 0 0 2px #fff,0 0 0 4px #596579}
.trafficdot:disabled{cursor:not-allowed;opacity:.12;transform:none}
.incident-delete,.deletereply{border:1px solid #f3b8ad;background:#fff5f3;color:#b42318;border-radius:7px;padding:3px 8px;font-size:10px;font-weight:700}
.deletereply{width:100%;padding:10px;margin-top:0}
.replymodalbuttons .deletereply{width:auto;min-width:150px}
@media(max-width:700px){.summaryright{gap:10px}.daytraffic{gap:6px}.trafficdot{width:17px;height:17px}.replymodalbuttons .deletereply{width:100%}}
.incidentphoto-input{width:100%;border:1px solid #dfe5ed;border-radius:9px;padding:8px;background:#fff;font-size:12px}
.incidentphoto-help{margin-top:5px;color:var(--muted);font-size:10px}
.incidentphoto-preview,.incidentphotos{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}
.incidentphoto-thumb{position:relative;width:74px;height:74px;border-radius:8px;overflow:hidden;border:1px solid #dfe5ed;background:#f8f9fc}
.incidentphoto-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.incidentphoto-thumb.pending{opacity:.82}
.incidentphoto-remove{position:absolute;top:3px;right:3px;width:22px;height:22px;border:0;border-radius:50%;background:#172033cc;color:#fff;font-weight:800;line-height:22px;padding:0;text-align:center}
.incidentphoto-link{display:block;width:100%;height:100%}
