:root{
  --navy:#0B2545; --navy-light:#13345E; --green:#1C8C4E; --green-light:#E5F3EA;
  --red:#C0392B; --red-light:#FBEAE8; --amber:#C77700; --amber-light:#FCF1DD;
  --purple:#7C3AED; --purple-light:#EFE7FD;
  --blue:#1E6FD9; --blue-light:#E8F1FD; --blue-border:#C7DDF7;
  --amber-panel:#FDF3E4; --amber-panel-border:#F3DDAF;
  --green-panel:#E7F6EC; --green-panel-border:#BFE3CB;
  --grey-bg:#F4F6F8; --border:#E1E5EA; --text:#1A1A1A; --muted:#667085;
}
*{box-sizing:border-box;}
body{ margin:0; font-family:-apple-system,"Segoe UI",Roboto,Arial,sans-serif; background:var(--grey-bg); color:var(--text); }

/* ---------- login page ---------- */
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); }
.login-card{ background:#fff; border-radius:14px; padding:36px 34px; width:100%; max-width:380px; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.login-card h1{ font-size:18px; color:var(--navy); margin:0 0 4px; }
.login-card p{ font-size:12.5px; color:var(--muted); margin:0 0 22px; }
.login-card label{ font-size:11.5px; font-weight:700; color:var(--navy); display:block; margin-bottom:5px; }
.login-card input{ width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:14px; margin-bottom:16px; }
.login-card button{ width:100%; padding:11px; border:none; border-radius:8px; background:var(--navy); color:#fff; font-weight:700; font-size:14px; cursor:pointer; }
.login-card button:hover{ background:var(--navy-light); }
.login-error{ background:var(--red-light); color:var(--red); font-size:12.5px; padding:9px 12px; border-radius:8px; margin-bottom:14px; display:none; }
.login-error.show{ display:block; }

/* ---------- app shell ---------- */
.topbar{ background:linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); color:#fff; padding:18px 28px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; }
.topbar h1{ margin:0 0 4px 0; font-size:19px; font-weight:700; }
.topbar p{ margin:0; font-size:12.5px; color:#C9D6E8; }

.countdown-top{ display:flex; align-items:center; gap:8px; margin-top:6px; flex-wrap:wrap; }
.countdown-label{ font-size:12px; color:#C9D6E8; }
.countdown-box{ background:rgba(255,255,255,.15); border-radius:8px; padding:4px 10px; text-align:center; min-width:44px; }
.countdown-box b{ display:block; font-size:15px; line-height:1.1; }
.countdown-box small{ font-size:9px; text-transform:uppercase; letter-spacing:.3px; color:#C9D6E8; }
.countdown-empty{ font-size:12px; color:#C9D6E8; }
.countdown-empty a{ color:#fff; text-decoration:underline; }
.countdown-live{ font-size:13px; font-weight:700; color:#8FE3AE; }

.countdown-chip{ font-size:11px; font-weight:700; color:var(--amber); background:var(--amber-light); padding:3px 8px; border-radius:20px; white-space:nowrap; display:inline-block; }
.countdown-chip.done{ color:var(--green); background:var(--green-light); }
.topbar-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.badge{ display:inline-block; background:var(--green); color:#fff; font-size:11px; padding:2px 9px; border-radius:20px; margin-left:8px; font-weight:600; vertical-align:middle; }
.incident-badge{ background:#fff; color:var(--red); border-radius:20px; padding:8px 16px; font-size:13px; font-weight:800; cursor:pointer; border:2px solid var(--red); white-space:nowrap; }
.incident-badge.zero{ color:var(--green); border-color:var(--green); }
.who-badge{ font-size:12px; color:#fff; background:rgba(255,255,255,.12); padding:7px 12px; border-radius:20px; }
.logout-btn{ font-size:12px; background:rgba(255,255,255,.12); color:#fff; border:1px solid rgba(255,255,255,.3); border-radius:20px; padding:7px 12px; cursor:pointer; }
.logout-btn:hover{ background:rgba(255,255,255,.22); }
.wrap{ padding:18px 28px 60px; max-width:1400px; margin:0 auto; }

.tabs{ display:flex; gap:6px; margin-bottom:18px; background:#fff; border:1px solid var(--border); border-radius:10px; padding:6px; }
.tab-btn{ flex:1; text-align:center; padding:11px 10px; border:none; background:transparent; border-radius:8px; font-size:13px; font-weight:700; color:var(--muted); cursor:pointer; transition:.15s; }
.tab-btn:hover{ background:#F4F6F8; }
.tab-btn.disabled, .tab-btn:disabled{ cursor:not-allowed; opacity:.45; }
.tab-btn.disabled:hover, .tab-btn:disabled:hover{ background:transparent; }
.tab-btn.active{ background:var(--navy); color:#fff; }
.tab-btn[data-tab="pre"].active{ background:var(--blue); }
.tab-btn[data-tab="impl"].active{ background:var(--amber); }
.tab-btn[data-tab="salas"].active{ background:var(--green); }

.tab-content{ display:none; }
.tab-content.active{ display:block; border-radius:14px; padding:16px; margin:0 0 6px; }
#tab-pre.active{ background:var(--blue-light); border:1px solid var(--blue-border); }
#tab-impl.active{ background:var(--amber-panel); border:1px solid var(--amber-panel-border); }
#tab-salas.active{ background:var(--green-panel); border:1px solid var(--green-panel-border); }

.cards{ display:grid; grid-template-columns:repeat(6,1fr); gap:12px; margin-bottom:16px; }
.card{ background:#fff; border:1px solid var(--border); border-radius:10px; padding:13px 15px; }
.card .num{ font-size:24px; font-weight:800; color:var(--navy); line-height:1.1; }
.card .lbl{ font-size:11px; color:var(--muted); margin-top:4px; font-weight:600; text-transform:uppercase; letter-spacing:.3px; }
.card.ok .num{ color:var(--green); } .card.warn .num{ color:var(--amber); } .card.danger .num{ color:var(--red); }

.praca-summary{ display:flex; gap:12px; margin-bottom:16px; }
.praca-box{ flex:1; background:#fff; border:1px solid var(--border); border-radius:10px; padding:13px 16px; display:flex; align-items:center; justify-content:space-between; }
.praca-box .name{ font-weight:700; font-size:13.5px; color:var(--navy); }
.praca-box .sub{ font-size:11.5px; color:var(--muted); margin-top:2px; }
.praca-box .barwrap{ width:130px; }
.bar{ height:8px; border-radius:5px; background:#E7EAEE; overflow:hidden; }
.bar > div{ height:100%; background:var(--green); }
.praca-box .pct{ font-size:11.5px; font-weight:700; color:var(--green); text-align:right; margin-top:3px; }

.controls{ display:flex; gap:10px; align-items:center; margin-bottom:12px; flex-wrap:wrap; background:#fff; padding:11px 13px; border:1px solid var(--border); border-radius:10px; }
.controls input[type=text]{ flex:1; min-width:170px; padding:8px 12px; border:1px solid var(--border); border-radius:7px; font-size:13px; }
.controls select{ padding:8px 10px; border:1px solid var(--border); border-radius:7px; font-size:13px; background:#fff; }
.controls .count{ font-size:12px; color:var(--muted); margin-left:auto; white-space:nowrap; }

table{ width:100%; border-collapse:collapse; background:#fff; border-radius:10px; overflow:hidden; border:1px solid var(--border); }
thead th{ background:var(--navy); color:#fff; text-align:left; padding:9px 9px; font-size:10.5px; text-transform:uppercase; letter-spacing:.3px; font-weight:700; }
tbody td{ padding:8px 9px; border-top:1px solid var(--border); font-size:12px; vertical-align:middle; }
tbody tr:hover{ background:#FAFBFC; }
.clin-name{ font-weight:700; color:var(--navy); font-size:12.5px;}
.clin-sub{ font-size:10.5px; color:var(--muted); margin-top:2px;}
.tag{ display:inline-block; font-size:10px; font-weight:700; padding:2px 7px; border-radius:20px; }
.tag.co{ background:#E3ECF7; color:var(--navy);} .tag.re{ background:#EAF6EE; color:var(--green);}
.coord-name{ font-weight:600; font-size:12px;}
.contact-row{ display:flex; gap:6px; margin-top:3px; flex-wrap:wrap;}
.chip{ font-size:10px; text-decoration:none; padding:2px 6px; border-radius:6px; font-weight:600; display:inline-flex; align-items:center; gap:3px; border:none; cursor:pointer; }
.chip.wa{ background:#DFF5E6; color:#1C8C4E; } .chip.mail{ background:#EAEDF2; color:#40506B; }
.chk{ width:16px; height:16px; cursor:pointer; accent-color:var(--green); }
.chk-cell{ text-align:center; }
.status-pill{ font-size:10px; font-weight:700; padding:3px 8px; border-radius:20px; display:inline-block; white-space:nowrap; }
.status-pill.ready{ background:var(--green-light); color:var(--green); }
.status-pill.progress{ background:var(--amber-light); color:var(--amber); }
.status-pill.risk{ background:var(--red-light); color:var(--red); }
textarea.obs{ width:100%; min-height:30px; border:1px solid var(--border); border-radius:6px; font-size:11px; padding:4px 6px; font-family:inherit; resize:vertical; }
.foot-note{ font-size:11px; color:var(--muted); margin-top:16px; line-height:1.6; }

.upload-cell{ display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.upload-btn{ font-size:10.5px; background:#EEF2FF; color:#3B4E9E; border:none; border-radius:6px; padding:4px 8px; cursor:pointer; font-weight:600; }
.thumb-row{ display:flex; align-items:center; gap:6px; }
.thumb{ width:34px; height:34px; object-fit:cover; border-radius:5px; border:1px solid var(--border); cursor:pointer; }
.thumb-pdf{ width:34px; height:34px; display:flex; align-items:center; justify-content:center; font-size:8px; font-weight:800; background:#FCE8E6; color:#B3261E; border-radius:5px; border:1px solid var(--border); text-decoration:none; }
.thumb-remove{ font-size:10px; color:var(--red); cursor:pointer; background:none; border:none; font-weight:700; padding:0;}
.no-img{ font-size:10px; color:#B0B7C3; font-style:italic; }
.upload-btn:disabled{ opacity:.5; cursor:not-allowed; }

.contacts-section{ margin-top:20px; background:#fff; border:1px solid var(--border); border-radius:10px; padding:18px; }
.contacts-section h2{ margin:0 0 4px 0; font-size:16px; color:var(--navy); }
.contacts-section .sub{ font-size:12px; color:var(--muted); margin-bottom:12px; }
.contacts-group-title{ font-size:11px; font-weight:800; color:var(--navy); text-transform:uppercase; letter-spacing:.4px; margin-bottom:8px; }
.contact-cards{ display:grid; grid-template-columns:repeat(auto-fit, minmax(220px,1fr)); gap:10px; }
.contact-card{ border:1px solid var(--border); background:var(--grey-bg); border-radius:9px; padding:12px 14px; display:flex; flex-direction:column; gap:4px; }
.contact-card .cname{ font-weight:800; color:var(--navy); font-size:13px; }
.contact-card .cregiao{ font-size:11px; color:var(--muted); font-weight:600; }
.contact-card .cwa{ margin-top:6px; align-self:flex-start; }

.incident-section{ margin-top:20px; background:#fff; border:1px solid var(--border); border-radius:10px; padding:18px; }
.incident-section h2{ margin:0 0 4px 0; font-size:16px; color:var(--navy); }
.incident-section .sub{ font-size:12px; color:var(--muted); margin-bottom:14px; }
.inc-form{ display:grid; grid-template-columns:1fr 1fr; gap:10px; background:var(--grey-bg); border:1px solid var(--border); border-radius:9px; padding:14px; margin-bottom:18px; }
.inc-form.hidden{ display:none; }
.inc-form label{ font-size:11px; font-weight:700; color:var(--navy); margin-bottom:4px; display:block; }
.inc-form input[type=text], .inc-form textarea, .inc-form select{ width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:7px; font-size:12.5px; font-family:inherit; }
.inc-form textarea{ min-height:56px; resize:vertical; }
.inc-form .full{ grid-column:1 / -1; }
.full.hidden{ display:none; }
.btn{ padding:9px 16px; border:none; border-radius:7px; font-size:12.5px; font-weight:700; cursor:pointer; }
.btn-primary{ background:var(--navy); color:#fff; }
.btn-primary:hover{ background:var(--navy-light); }
.btn-outline{ background:#fff; border:1px solid var(--border); color:var(--navy); }
.btn-outline:hover{ border-color:var(--navy); }
.btn-sm{ padding:5px 10px; font-size:11px; }
.toggle-form-row{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;}

.inc-card{ border-left:5px solid var(--border); background:#fbfbfc; border-radius:8px; padding:12px 14px; margin-bottom:10px; border-top:1px solid var(--border); border-right:1px solid var(--border); border-bottom:1px solid var(--border); }
.inc-card.st-aberta{ border-left-color:var(--red); background:var(--red-light); }
.inc-card.st-tratativa{ border-left-color:var(--amber); background:var(--amber-light); }
.inc-card.st-escalada{ border-left-color:var(--purple); background:var(--purple-light); }
.inc-card.st-resolvida{ border-left-color:var(--green); background:#fff; opacity:.75; }
.inc-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap;}
.inc-title{ font-weight:800; font-size:13.5px; color:var(--navy); }
.inc-meta{ font-size:10.5px; color:var(--muted); margin-top:2px; }
.inc-body{ font-size:12px; margin-top:8px; line-height:1.5; }
.inc-body b{ color:var(--navy); }
.inc-controls{ display:flex; gap:8px; align-items:center; margin-top:8px; }
.inc-status-select{ font-size:11px; padding:4px 7px; border-radius:6px; border:1px solid var(--border); font-weight:700; }
.inc-del{ font-size:10.5px; color:var(--red); background:none; border:none; cursor:pointer; font-weight:700; }
.status-tag{ font-size:10px; font-weight:800; padding:3px 9px; border-radius:20px; white-space:nowrap;}
.status-tag.aberta{ background:var(--red); color:#fff; }
.status-tag.tratativa{ background:var(--amber); color:#fff; }
.status-tag.escalada{ background:var(--purple); color:#fff; }
.status-tag.resolvida{ background:var(--green); color:#fff; }
.empty-note{ font-size:12.5px; color:var(--muted); font-style:italic; padding:10px 0;}

.clinic-acc{ background:#fff; border:1px solid var(--border); border-radius:10px; margin-bottom:10px; overflow:hidden; }
.acc-head{ display:flex; align-items:center; justify-content:space-between; padding:12px 16px; cursor:pointer; gap:12px; flex-wrap:wrap; }
.acc-head:hover{ background:#FAFBFC; }
.acc-left{ display:flex; flex-direction:column; }
.acc-mid{ display:flex; align-items:center; gap:14px; flex:1; justify-content:flex-end; }
.acc-progress{ width:140px; }
.acc-chevron{ font-size:16px; color:var(--muted); transition:.15s; }
.clinic-acc.open .acc-chevron{ transform:rotate(90deg); }
.acc-body{ display:none; padding:16px; border-top:1px solid var(--border); background:#FAFBFC; }
.clinic-acc.open .acc-body{ display:flex; gap:18px; flex-wrap:wrap; }
.acc-map{ width:260px; flex-shrink:0; }
.acc-map img{ width:100%; border-radius:8px; border:1px solid var(--border); cursor:zoom-in; }
.acc-map .no-map{ font-size:11.5px; color:var(--muted); font-style:italic; background:#fff; border:1px dashed var(--border); border-radius:8px; padding:20px; text-align:center; }
.acc-rooms-wrap{ flex:1; min-width:280px; }
.acc-rooms-toolbar{ margin-bottom:8px; }
.reacao-dica{ font-size:11.5px; color:var(--navy); background:var(--green-panel); border:1px solid var(--green-panel-border); border-radius:8px; padding:9px 12px; margin-top:14px; line-height:1.5; }

.room-row{ border:1px solid var(--border); border-left:4px solid var(--border); border-radius:8px; padding:8px 10px; margin-bottom:8px; background:#fff; font-size:12px; }
.room-row:last-child{ margin-bottom:0; }
.room-row-top{ display:grid; grid-template-columns:1.3fr 1fr 110px 26px; gap:8px; align-items:center; margin-bottom:6px; }
.room-row-bottom{ display:grid; grid-template-columns:1.3fr auto auto 140px; gap:8px; align-items:center; }
.room-row input[type=text], .room-row select{ font-size:11.5px; padding:5px 7px; border:1px solid var(--border); border-radius:6px; font-family:inherit; }
.room-chk-lbl{ display:flex; align-items:center; gap:5px; font-size:11px; color:var(--muted); white-space:nowrap; }
.room-remove{ background:none; border:none; color:var(--red); font-weight:700; cursor:pointer; font-size:13px; justify-self:center; }

.room-row.reacao-parceiro{ border-left-color:var(--green); background:var(--green-light); }
.room-row.reacao-indiferente{ border-left-color:var(--muted); }
.room-row.reacao-resistente{ border-left-color:var(--amber); background:var(--amber-light); }
.room-row.reacao-critico{ border-left-color:var(--red); background:var(--red-light); }

/* lightbox + modal */
.lightbox{ display:none; position:fixed; inset:0; background:rgba(11,37,69,.85); z-index:999; align-items:center; justify-content:center; cursor:zoom-out; }
.lightbox.show{ display:flex; }
.lightbox img{ max-width:90%; max-height:90%; border-radius:8px; box-shadow:0 10px 40px rgba(0,0,0,.5); }

.modal-overlay{ display:none; position:fixed; inset:0; background:rgba(11,37,69,.55); z-index:1000; align-items:center; justify-content:center; }
.modal-overlay.show{ display:flex; }
.modal-box{ background:#fff; border-radius:12px; padding:24px; width:100%; max-width:380px; }
.sugestao-row{ display:flex; gap:6px; }
.modal-box h3{ margin:0 0 12px; font-size:16px; color:var(--navy); }
.modal-box label{ font-size:11px; font-weight:700; color:var(--navy); display:block; margin:10px 0 4px; }
.modal-box input{ width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:7px; font-size:13px; }
.modal-actions{ display:flex; gap:8px; margin-top:18px; }
.toast{ position:fixed; bottom:20px; right:20px; background:var(--navy); color:#fff; padding:12px 18px; border-radius:8px; font-size:13px; z-index:1100; box-shadow:0 8px 24px rgba(0,0,0,.25); display:none; }
.toast.show{ display:block; }
.toast.error{ background:var(--red); }

input[type=datetime-local]{ padding:6px 8px; border:1px solid var(--border); border-radius:6px; font-size:12px; font-family:inherit; }

/* ---------- página de configurações ---------- */
.config-section{ background:#fff; border:1px solid var(--border); border-radius:10px; padding:20px 22px; margin-bottom:18px; }
.config-section h2{ margin:0 0 4px; font-size:16px; color:var(--navy); }
.config-section h3{ margin:20px 0 4px; font-size:13.5px; color:var(--navy); }
.config-section .sub{ font-size:12px; color:var(--muted); margin-bottom:12px; }
.config-golive{ display:flex; align-items:flex-end; gap:12px; background:var(--grey-bg); border:1px solid var(--border); border-radius:9px; padding:14px; margin-bottom:6px; }
.config-golive label{ font-size:11px; font-weight:700; color:var(--navy); display:block; margin-bottom:5px; }
.admins-list{ display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); gap:10px; margin-bottom:16px; }
.admin-card{ border:1px solid var(--border); background:var(--grey-bg); border-radius:9px; padding:10px 14px; }
.admin-card .admin-name{ font-weight:700; color:var(--navy); font-size:13px; }
.admin-card .admin-user{ font-size:11px; color:var(--muted); }
.config-admin-form{ display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; background:var(--grey-bg); border:1px solid var(--border); border-radius:9px; padding:14px; }
.config-admin-form label{ font-size:11px; font-weight:700; color:var(--navy); display:block; margin-bottom:5px; }
.config-admin-form input{ padding:8px 10px; border:1px solid var(--border); border-radius:7px; font-size:13px; }

@media (max-width:1100px){ .cards{ grid-template-columns:repeat(3,1fr);} .praca-summary{flex-direction:column;} .inc-form{grid-template-columns:1fr;} .room-row-top, .room-row-bottom{grid-template-columns:1fr; gap:4px;} }
