* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font: 15px/1.4 system-ui, "Segoe UI", sans-serif; }
button, input { font: inherit; color: inherit; }
button { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--fg); }
button.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type=date] { background: var(--bg); border: 2px solid var(--line); border-radius: 6px; padding: 5px 8px; }

.top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px 16px; align-items: center; padding: 8px 12px; background: var(--brand); color: var(--white); border-bottom: 2px solid var(--line); }
.top-left { display: flex; gap: 8px; align-items: center; }
.top-right { display: flex; gap: 8px 16px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.brand { display: flex; align-items: center; justify-content: center; gap: 14px; }
.logo { height: 48px; width: auto; display: block; }
.name { font-size: 24px; font-weight: 800; letter-spacing: .5px; line-height: 1; white-space: nowrap; }
.ai { font-size: 30px; font-weight: 800; letter-spacing: 3px; line-height: 1; padding-left: 14px; border-left: 3px solid var(--white); }
.top :focus-visible { outline-color: var(--white); }
.top button, .top .exp summary { background: transparent; color: var(--white); border-color: var(--white); }
.top button:hover { background: rgba(255, 255, 255, .15); }
.top button.primary { background: var(--white); color: var(--brand); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 36px; padding: 0; }
.iconbtn svg { width: 22px; height: 22px; }
@media (max-width: 800px) { .top { grid-template-columns: 1fr; justify-items: center; } .top-left, .top-right { justify-content: center; } }

.daybar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.daybar h1 { font-size: 18px; margin: 0 0 0 6px; }
.daybar input[type=date] { font-size: 16px; font-weight: 600; }
.daybar .count { font-weight: 700; font-size: 16px; }
.daybar .count::before { content: "· "; }
.sync { display: flex; gap: 10px; align-items: center; }
#syncStatus { font-weight: 600; }

.exp { position: relative; }
.exp summary { list-style: none; cursor: pointer; background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 6px 12px; font-weight: 600; }
.exp summary::-webkit-details-marker { display: none; }
.exp .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 2000; min-width: 290px; background: var(--bg); border: 2px solid var(--fg); border-radius: 6px; display: flex; flex-direction: column; }
.exp .menu a { padding: 9px 12px; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); cursor: pointer; }
.exp .menu :focus-visible { outline-color: var(--focus); }
.exp .menu a:last-child { border-bottom: 0; }
.exp .menu a:hover, .exp .menu a:focus-visible { background: var(--panel); text-decoration: underline; }
.kind { display: inline-block; font-size: 12px; font-weight: 700; border: 2px solid var(--fg); border-radius: 4px; padding: 0 5px; margin-right: 6px; white-space: nowrap; }
.kind.ret { background: var(--fg); color: var(--bg); }

.banner { padding: 8px 12px; font-weight: 700; border-bottom: 3px double var(--fg); background: var(--panel); }
.banner::before { content: "⚠ "; }
.banner.info::before { content: "ℹ "; }

main { flex: 1; display: flex; min-height: 0; }
aside { width: 380px; max-width: 45%; overflow-y: auto; border-right: 2px solid var(--line); background: var(--bg); }
#map { flex: 1; min-height: 300px; }
@media (max-width: 800px) { main { flex-direction: column-reverse; } aside { width: 100%; max-width: none; max-height: 45%; border-right: 0; } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 0; padding: 8px 10px; }
.row:hover { background: var(--panel); }
li.sel > .row { background: var(--panel); border-left: 6px solid var(--fg); padding-left: 4px; }
.num { flex: none; min-width: 26px; height: 26px; border-radius: 13px; background: var(--fg); color: var(--bg); font-weight: 800; text-align: center; line-height: 26px; }
.ico { width: 26px; height: 26px; flex: none; color: var(--fg); }
.row .txt { flex: 1; min-width: 0; }
.row .t1 { font-weight: 700; }
.row .t2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alertline { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; padding: 0 10px 6px 46px; }
.tri { width: 18px; height: 16px; flex: none; }
.more { padding: 0 10px 8px 46px; font-size: 13px; }
.more dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
.more dt { color: var(--muted); }
.more dd { margin: 0; overflow-wrap: anywhere; }
.linkbtn { background: none; border: 0; padding: 0 10px 8px 46px; text-decoration: underline; cursor: pointer; font-size: 13px; }
.empty-day { padding: 24px 14px; font-weight: 600; }
.legend { padding: 8px 10px; }
.legend .lg { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.legend .lg .pinbox { width: 34px; height: 34px; background: var(--brand); color: var(--white); border: 2px solid var(--white); border-radius: 7px; box-shadow: 0 0 0 1px var(--brand); display: flex; align-items: center; justify-content: center; }
.legend .pinbox .ico { color: var(--white); width: 24px; height: 24px; }
.legend-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* pinos do mapa: forma + ícone + número (nunca só cor) */
.pinwrap { background: none; border: 0; }
.pin { position: relative; width: 40px; height: 40px; background: var(--brand); color: var(--white); border: 3px solid var(--white); border-radius: 8px; box-shadow: 0 0 0 2px var(--brand), 0 2px 6px rgba(8,44,98,.5); display: flex; align-items: center; justify-content: center; transition: transform .1s; }
.pin .ico { width: 28px; height: 28px; color: var(--white); }
.pin .pn { position: absolute; top: -10px; right: -10px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--white); color: var(--brand); border: 2px solid var(--brand); font: 800 12px/16px system-ui, sans-serif; text-align: center; padding: 0 3px; }
.pin.sel { transform: scale(1.35); background: var(--white); color: var(--brand); border: 5px solid var(--brand); box-shadow: 0 0 0 3px var(--white), 0 3px 10px rgba(8,44,98,.6); z-index: 1000; }
.pin.sel .ico { color: var(--brand); }
.pin.sel .pn { background: var(--brand); color: var(--white); border-color: var(--white); }
.pinwrap:focus-visible .pin { outline: 3px solid var(--brand); outline-offset: 3px; }
.pin .pr { position: absolute; left: -10px; bottom: -10px; width: 20px; height: 20px; border-radius: 4px; background: var(--white); color: var(--brand); border: 2px solid var(--brand); font: 800 14px/16px system-ui, sans-serif; text-align: center; }
.pin.sel .pr { background: var(--brand); color: var(--white); border-color: var(--white); }
.pin.alert { background: transparent; border: 0; box-shadow: none; width: 46px; height: 42px; }
.pin.alert svg.tri-big { width: 46px; height: 42px; }
.pin.alert .pn { top: -8px; right: -6px; }
.pin.alert .tri-fill { fill: var(--white); stroke: var(--brand); }
.pin.alert .tri-ex { fill: var(--brand); }
.pin.alert.sel { transform: scale(1.35); }
.pin.alert.sel .tri-fill { fill: var(--brand); }
.pin.alert.sel .tri-ex { fill: var(--white); }
.truept { width: 8px; height: 8px; background: var(--brand); border: 2px solid var(--white); border-radius: 50%; }

.popup { min-width: 230px; font: 14px/1.4 system-ui, sans-serif; color: var(--brand); }
.popup .pt { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.popup .pt .ico { color: var(--brand); width: 30px; height: 30px; }
.popup .when { font-size: 18px; font-weight: 800; margin: 4px 0; }
.popup .where { margin: 4px 0 8px; }
.popup .al { font-weight: 700; margin: 6px 0; }
.popup .btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.popup button, .popup a.btn { font-size: 13px; padding: 4px 8px; background: var(--brand-8); color: var(--brand); border: 2px solid var(--brand-60); border-radius: 6px; text-decoration: none; cursor: pointer; }
.popup dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; font-size: 13px; }
.popup dt { color: var(--brand-75); }
.popup dd { margin: 0; overflow-wrap: anywhere; }
#map.placing { cursor: crosshair; }

/* técnico, antecipação e dados do cliente */
.kind.ant { border-style: dashed; }
.row .t3, .tec { font-size: 13px; font-weight: 600; }
.tec { margin: 2px 0 6px; }
.more dd.pre { white-space: pre-wrap; }

/* painel "Atribuir" */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 3000; overflow-y: auto; padding: 14px 16px 24px; background: var(--bg); color: var(--fg); border-left: 3px solid var(--fg); box-shadow: -6px 0 18px rgba(8, 44, 98, .45); }
.drawer h2 { font-size: 20px; margin: 0; }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dsub { margin: 6px 0 10px; color: var(--muted); }
.dline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.dline select, .dline input[type=text], .tecmgr input[type=text] { font: inherit; color: inherit; background: var(--bg); border: 2px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.dmsg { min-height: 1.4em; font-weight: 700; margin: 4px 0; }
.alist { list-style: none; margin: 8px 0; padding: 0; }
.alist li { border-bottom: 1px solid var(--line); padding: 6px 0; }
.arow { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.arow input, .antbox input { width: 20px; height: 20px; flex: none; }
.atxt { display: flex; flex-direction: column; min-width: 0; }
.antbox { display: block; margin: 4px 0 0 30px; font-size: 14px; cursor: pointer; }
.tecmgr { margin-top: 14px; }
.tecmgr summary { cursor: pointer; font-weight: 700; }
.tlist { list-style: none; padding: 0; margin: 8px 0; }
.tlist li { padding: 4px 0; }
