/* PCP DZ9 — mesmos tokens do Portal DZ9 (claro por padrão, body.dark = preto quente). */
:root {
  --bg: #fff; --surface: #fff; --line: #E4D6BD; --text: #14120F; --text2: #5F5849;
  --card: #F3EADB; --field: #fff; --field-line: #8F8168; --hover: #FDEFD9;
  --orange: #F89833; --orange-hi: #FFAB52; --orange-ink: #9A4B00; --tint: #FDEFD9;
  --red: #B3261E; --red-ink: #B3261E; --green-ink: #1F6F43;
  --rail: #14120F; --rail-line: #35312A; --rail-text: #E9E2D4; --rail-hover: #2A2620; --rail-badge: #3A362F;
  --overlay: rgba(20,18,15,.55);
  --shadow-card: 0 1px 2px rgba(20,18,15,.06), 0 6px 14px -8px rgba(20,18,15,.18);
  --shadow-pop: 0 10px 28px rgba(20,18,15,.2);
  --focus: #14120F; --scroll: #CDBF9F; --strong: #14120F; --on-strong: #fff; --inset: #fff;
  /* status do card: fundo, borda, etiqueta */
  --st-pendente-bg: #ECEAE6; --st-pendente-borda: #C4BFB5; --st-pendente-tag: #6B6558; --st-pendente-txt: #fff;
  --st-agendado-bg: #E3F2E8; --st-agendado-borda: #9CCBB0; --st-agendado-tag: #1F6F43; --st-agendado-txt: #fff;
  --st-cancelado-bg: #FBE4E1; --st-cancelado-borda: #E8A9A1; --st-cancelado-tag: #B3261E; --st-cancelado-txt: #fff;
  --st-adiado-bg: #FDEBC8; --st-adiado-borda: #F0B65E; --st-adiado-tag: #E8A400; --st-adiado-txt: #14120F;
  color-scheme: light;
}
body.dark {
  --bg: #14120F; --surface: #1D1A16; --line: #342F28; --text: #F5EFE3; --text2: #BDB2A0;
  --card: #1D1A16; --field: #14120F; --field-line: #776F61; --hover: #2A261F; --inset: #2A261F;
  --orange-ink: #FFB45A; --tint: #3A2A14; --red-ink: #FF8A7E; --green-ink: #7FD3A3;
  --rail: #0C0B09; --rail-line: #26231E; --rail-hover: #26231E; --rail-badge: #35312A;
  --overlay: rgba(0,0,0,.68); --focus: #FFB45A; --scroll: #4A443A; --strong: #F5EFE3; --on-strong: #14120F;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 8px 18px -10px rgba(0,0,0,.6);
  --st-pendente-bg: #25221D; --st-pendente-borda: #4A443A; --st-pendente-tag: #BDB2A0; --st-pendente-txt: #14120F;
  --st-agendado-bg: #16301F; --st-agendado-borda: #2F6A45; --st-agendado-tag: #7FD3A3; --st-agendado-txt: #0F2417;
  --st-cancelado-bg: #3B1A17; --st-cancelado-borda: #7A3A33; --st-cancelado-tag: #FF7A6E; --st-cancelado-txt: #2A0A07;
  --st-adiado-bg: #3A2A14; --st-adiado-borda: #7A5A22; --st-adiado-tag: #F5B93A; --st-adiado-txt: #14120F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums; scrollbar-color: var(--scroll) transparent;
}
::selection { background: var(--orange); color: #14120F; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Estrutura ---------- */
.app { display: flex; align-items: stretch; min-height: 100vh; }
.rail {
  width: 232px; flex: none; background: var(--rail); color: #F5EFE3; display: flex; flex-direction: column; gap: 28px;
  padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--rail-line);
}
.logo { width: 116px; height: auto; margin: 0 0 0 10px; display: block; }
.rail-titulo { margin: -14px 0 0 10px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0;
  border-radius: 10px; background: transparent; color: var(--rail-text); text-align: left; text-decoration: none;
}
.nav-item:hover { background: var(--rail-hover); }
.nav-item.ativa { background: var(--orange); color: #14120F; font-weight: 600; }
.nav-item .i { width: 18px; height: 18px; }
.nav-n { margin-left: auto; min-width: 22px; padding: 2px 7px; border-radius: 99px; background: var(--rail-badge); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.nav-item.ativa .nav-n { background: #14120F; }
.rail-rodape { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.rail-user { padding: 0 12px; font-size: 12px; color: #BDB2A0; }
.rail-user b { display: block; color: #F5EFE3; font-size: 13px; }

.main { flex: 1; min-width: 0; padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -.01em; }
.page-head p { color: var(--text2); }
.page-head .grow { flex: 1; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--field-line); background: var(--surface); font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #14120F; }
.btn.primary:hover { background: var(--orange-hi); }
.btn.strong { background: var(--strong); border-color: var(--strong); color: var(--on-strong); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
.btn.danger { color: var(--red-ink); }
.btn:disabled { opacity: .55; }
.btn.ghost { border-color: transparent; background: transparent; }
.rail .btn { background: transparent; border-color: var(--rail-line); color: var(--rail-text); font-weight: 500; }
.rail .btn:hover { background: var(--rail-hover); }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text2); min-width: 0; }
.in, select.in {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--field-line); border-radius: 8px;
  background: var(--field); color: var(--text); font-weight: 400;
}
.in[readonly] { border-color: transparent; background: transparent; padding-left: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 13px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600;
}
.chip:hover { background: var(--hover); }
.chip.on { background: var(--strong); color: var(--on-strong); border-color: var(--strong); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--orange)); box-shadow: 0 0 0 2px #fff8; }
.chip .n { font-size: 11px; opacity: .75; }

/* ---------- Faixa de filtros ---------- */
.filtros { display: flex; flex-direction: column; gap: 10px; }
.filtros-linha { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filtros-linha .rot { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); margin-right: 4px; }
.filtros .in { width: auto; min-height: 34px; padding: 4px 8px; }

/* ---------- Mapa ---------- */
.mapa-wrap { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-card); }
#mapa { height: 420px; background: var(--card); z-index: 0; }
.mapa-aviso {
  position: absolute; left: 12px; bottom: 12px; z-index: 500; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow-card);
}
.pin { position: relative; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -100%); width: max-content; }
.pin-corpo {
  display: flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--st-tag); color: var(--st-txt); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); white-space: nowrap;
}
.pin-corpo i { width: 9px; height: 9px; border-radius: 50%; background: var(--inst, #fff); border: 1.5px solid #fff; flex: none; }
.pin::after { content: ""; width: 0; height: 0; border: 6px solid transparent; border-top-color: var(--st-tag); margin-top: -1px; }
.pin.foco .pin-corpo { outline: 3px solid var(--focus-pin, #14120F); transform: scale(1.12); }
.pin.st-pendente { --st-tag: var(--st-pendente-tag); --st-txt: var(--st-pendente-txt); }
.pin.st-agendado { --st-tag: var(--st-agendado-tag); --st-txt: var(--st-agendado-txt); }
.pin.st-cancelado { --st-tag: var(--st-cancelado-tag); --st-txt: var(--st-cancelado-txt); }
.pin.st-adiado { --st-tag: var(--st-adiado-tag); --st-txt: var(--st-adiado-txt); }
.leaflet-marker-icon.pin-icon { background: none; border: 0; }
.leaflet-tooltip.pin-tip {
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  box-shadow: var(--shadow-pop); white-space: normal; width: 260px; font: inherit;
}
.leaflet-tooltip.pin-tip::before { display: none; }
.tip-os { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 700; }
.tip dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; }
.tip dt { color: var(--text2); } .tip dd { margin: 0; }

/* ---------- Cards de OS ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.os-card {
  --bg-c: var(--st-pendente-bg); --bd-c: var(--st-pendente-borda); --tag-c: var(--st-pendente-tag); --tag-t: var(--st-pendente-txt);
  background: var(--bg-c); border: 1px solid var(--bd-c); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-card); transition: box-shadow .15s;
}
.os-card.st-agendado { --bg-c: var(--st-agendado-bg); --bd-c: var(--st-agendado-borda); --tag-c: var(--st-agendado-tag); --tag-t: var(--st-agendado-txt); }
.os-card.st-cancelado { --bg-c: var(--st-cancelado-bg); --bd-c: var(--st-cancelado-borda); --tag-c: var(--st-cancelado-tag); --tag-t: var(--st-cancelado-txt); }
.os-card.st-adiado { --bg-c: var(--st-adiado-bg); --bd-c: var(--st-adiado-borda); --tag-c: var(--st-adiado-tag); --tag-t: var(--st-adiado-txt); }
.os-card.foco { box-shadow: 0 0 0 3px var(--tag-c), var(--shadow-card); }
.os-card.rascunho { border-style: dashed; }
.os-topo { display: flex; align-items: center; gap: 8px; }
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; background: var(--tag-c); color: var(--tag-t); font-size: 12px; font-weight: 700; }
.os-topo .grow { flex: 1; }
.os-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.os-grade .full { grid-column: 1 / -1; }
.os-card .in { background: var(--field); }
.os-card .in[readonly] { background: transparent; }
.valor { font-size: 14px; word-break: break-word; }
.valor.vazio { color: var(--text2); }
.status-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.status-seg button {
  min-height: 34px; border-radius: 8px; border: 1px solid var(--bd-c); background: var(--field); font-size: 12px; font-weight: 700;
}
.status-seg button.on { background: var(--tag-c); color: var(--tag-t); border-color: var(--tag-c); }
.os-rodape { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.os-rodape .grow { flex: 1; }
.aviso-geo { font-size: 12px; color: var(--red-ink); font-weight: 600; }
.vazio-msg { color: var(--text2); padding: 30px 0; text-align: center; grid-column: 1 / -1; }

/* ---------- Painel lateral ---------- */
.aside {
  width: 330px; flex: none; border-left: 1px solid var(--line); background: var(--surface); padding: 22px 18px 40px;
  display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.aside h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.aside h2 .grow { flex: 1; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-nav strong { flex: 1; text-align: center; font-size: 15px; }
.cal-grade { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text2); padding: 2px 0 4px; }
.cal-dia {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; min-height: 46px; padding: 4px 0;
  border: 1px solid transparent; border-radius: 9px; background: transparent; font-size: 13px;
}
.cal-dia:hover { background: var(--hover); }
.cal-dia.fora { opacity: .38; }
.cal-dia.hoje { border-color: var(--orange); }
.cal-dia.sel { background: var(--strong); color: var(--on-strong); }
.cal-dia .q { font-size: 10px; font-weight: 700; min-width: 17px; padding: 0 5px; border-radius: 99px; background: var(--orange); color: #14120F; line-height: 15px; }
.cal-dia.sel .q { background: var(--orange); }
.inst-lista { display: flex; flex-direction: column; gap: 12px; }
.inst-bloco { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg); }
.inst-bloco.sel { border-color: var(--orange); box-shadow: 0 0 0 2px var(--tint); }
.inst-nome { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 0; text-align: left; font-weight: 700; }
.inst-nome .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.inst-nome .n { margin-left: auto; font-size: 12px; color: var(--text2); font-weight: 600; }
.inst-os { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.inst-os button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 1px solid var(--bd, var(--line));
  background: var(--bgc, var(--surface)); border-radius: 8px; padding: 5px 8px; font-size: 12px;
}
.inst-os button:hover { filter: brightness(.97); }
.inst-os button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bd, var(--line)); flex: none; }
.inst-os .quem { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.inst-os b { font-weight: 700; }
.inst-os .cancelado b, .inst-os .cancelado .quem { text-decoration: line-through; }
.inst-os .st-pendente { --bd: var(--st-pendente-borda); --bgc: var(--st-pendente-bg); }
.inst-os .st-agendado { --bd: var(--st-agendado-tag); --bgc: var(--st-agendado-bg); }
.inst-os .st-cancelado { --bd: var(--st-cancelado-tag); --bgc: var(--st-cancelado-bg); }
.inst-os .st-adiado { --bd: var(--st-adiado-tag); --bgc: var(--st-adiado-bg); }
.inst-vazio { font-size: 12px; color: var(--text2); margin-top: 6px; }

/* ---------- Diálogo e aviso ---------- */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--surface); color: var(--text); width: min(420px, 92vw); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: var(--overlay); }
dialog h2 { font-size: 17px; margin-bottom: 12px; }
dialog .acoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.inst-edit { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.inst-edit input[type=color] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--strong); color: var(--on-strong);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow-pop); z-index: 2000; max-width: 90vw;
}
.toast.erro { background: var(--red); color: #fff; }

/* ---------- Login ---------- */
.tela-login { min-height: 100vh; display: grid; place-items: center; background: #14120F; padding: 24px; }
.login-conteudo { display: flex; flex-direction: column; gap: 26px; align-items: center; width: min(380px, 100%); }
.login-conteudo .logo { width: 150px; margin: 0; }
.caixa-login { width: 100%; background: #1D1A16; border: 1px solid #342F28; border-radius: 16px; padding: 24px; color: #F5EFE3; }
.caixa-login h2 { font-size: 20px; }
.caixa-login .sub { color: #BDB2A0; margin: 4px 0 18px; }
.caixa-login form { display: flex; flex-direction: column; gap: 12px; }
.caixa-login label { font-size: 12px; font-weight: 600; color: #BDB2A0; display: flex; flex-direction: column; gap: 4px; }
.caixa-login input { background: #14120F; border: 1px solid #776F61; color: #F5EFE3; border-radius: 8px; min-height: 40px; padding: 8px 10px; }
.caixa-login .erro { color: #FF8A7E; font-weight: 600; min-height: 18px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .app { flex-wrap: wrap; }
  .aside { width: 100%; height: auto; position: static; border-left: 0; border-top: 1px solid var(--line); order: 3; }
}
@media (max-width: 760px) {
  .rail { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; }
  .rail-titulo { display: none; }
  .nav { flex-direction: row; }
  .rail-rodape { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .rail-user { display: none; }
  .main { padding: 16px; }
  #mapa { height: 320px; }
}

/* ---------- v0.2: horário, tempo estimado, instaladores (multi), linha do tempo ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.os-grade .trio { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1.15fr .8fr; gap: 8px 10px; }
.os-grade .duo { grid-column: 1 / -1; display: grid; grid-template-columns: .85fr 1.5fr; gap: 8px 10px; }
.os-grade .trio > *, .os-grade .duo > * { min-width: 0; }
.multi { position: relative; }
.multi > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 400; color: var(--text); }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary .nomes { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi > summary .nomes.vazio { color: var(--text2); }
.multi-lista { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--field-line); border-radius: 10px; box-shadow: var(--shadow-pop); max-height: 230px; overflow: auto; padding: 6px; }
.multi-lista label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); }
.multi-lista label:hover { background: var(--hover); }
.multi-lista .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.multi-lista .vazio { padding: 8px; font-size: 12px; color: var(--text2); }

.pin-corpo .seq { display: grid; place-items: center; min-width: 16px; height: 16px; border-radius: 50%; background: #fff; color: #14120F; font-size: 11px; }
.pin-corpo .dots { display: inline-flex; gap: 2px; }
.pin-corpo .dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; background: var(--c, #fff); }
.pin.empresa { --st-tag: #14120F; --st-txt: #F89833; }
.pin.empresa .pin-corpo { border-color: #F89833; }

.tl { --hpx: 64px; --nome-w: 226px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); padding: 12px 0 0; overflow: hidden; }
.tl-topo { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 14px 12px; }
.tl-topo h2 { font-size: 17px; margin-right: 8px; }
.tl-topo .in { width: auto; min-height: 34px; padding: 4px 8px; }
.tl-dica { font-size: 12px; color: var(--text2); margin-left: auto; }
.tl-scroll { overflow-x: auto; position: relative; border-top: 1px solid var(--line); }
.tl-grade { width: calc(var(--nome-w) + 24 * var(--hpx)); }
.tl-linha { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.tl-linha:last-child { border-bottom: 0; }
.tl-nome { position: sticky; left: 0; z-index: 6; width: var(--nome-w); flex: none; background: var(--surface); padding: 10px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.tl-nome b { display: flex; align-items: center; gap: 8px; }
.tl-nome .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.tl-nome small { color: var(--text2); font-size: 12px; }
.tl-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.tl-acoes .btn { min-height: 30px; padding: 0 9px; font-size: 12px; }
.tl-acoes .btn[aria-pressed="true"] { background: var(--strong); color: var(--on-strong); border-color: var(--strong); }
.tl-acoes .btn.primary[aria-pressed="true"] { background: var(--green-ink); border-color: var(--green-ink); color: #fff; }
.tl-pista { position: relative; overflow: hidden; width: calc(24 * var(--hpx)); min-height: 126px; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: var(--hpx) 100%; }
.tl-eixo .tl-nome { min-height: 28px; padding: 6px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); }
.tl-eixo .tl-pista { min-height: 28px; }
.tl-hora { position: absolute; top: 6px; font-size: 11px; font-weight: 600; color: var(--text2); transform: translateX(5px); }
.tl-agora { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--orange); z-index: 2; pointer-events: none; }
.tl-bloco {
  --bg-c: var(--st-pendente-bg); --tag-c: var(--st-pendente-tag);
  position: absolute; top: 10px; height: 56px; z-index: 3; border-radius: 9px; padding: 4px 8px; overflow: hidden; text-align: left;
  border: 2px solid var(--tag-c); background: var(--bg-c); color: var(--text); display: flex; flex-direction: column; justify-content: center;
  gap: 1px; font-size: 12px; line-height: 1.25; cursor: grab; touch-action: none; user-select: none;
}
.tl-bloco.st-agendado { --bg-c: var(--st-agendado-bg); --tag-c: var(--st-agendado-tag); }
.tl-bloco.st-adiado { --bg-c: var(--st-adiado-bg); --tag-c: var(--st-adiado-tag); }
.tl-bloco b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-bloco span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.tl-bloco .aviso { color: var(--red-ink); font-weight: 700; }
.tl-bloco.atraso { border-style: dashed; border-color: var(--red); }
.tl-bloco.arrastando { cursor: grabbing; z-index: 20; box-shadow: var(--shadow-pop); }
.tl-bloco.foco { box-shadow: 0 0 0 3px var(--focus); }
.tl-trajeto { position: absolute; top: 70px; height: 16px; z-index: 3; font-size: 10px; line-height: 14px; white-space: nowrap; overflow: hidden; color: var(--text);
  border: 1px solid var(--c); border-radius: 8px; background: color-mix(in srgb, var(--c) 28%, var(--surface)); padding: 0 5px; text-align: center; }
.tl-trajeto.volta { border-style: dashed; }
/* "Voltar à empresa" como item da sequência: faixa própria abaixo dos trajetos */
.tl-volta { position: absolute; top: 92px; height: 26px; min-width: 96px; z-index: 4; display: flex; align-items: center; gap: 4px; padding: 0 4px 0 9px; border-radius: 13px;
  background: var(--strong); color: var(--on-strong); border: 2px solid var(--c); font-size: 11px; font-weight: 700; white-space: nowrap; cursor: grab; touch-action: none; user-select: none; }
.tl-volta span { flex: 1; }
.tl-volta .x { width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.tl-volta .x:hover { background: rgba(255,255,255,.25); }
.tl-volta.arrastando { cursor: grabbing; z-index: 20; box-shadow: var(--shadow-pop); }
.tl-volta:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tl-acoes .chip-volta { cursor: grab; touch-action: none; border-style: dashed; }
.fantasma-volta { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; padding: 5px 11px; border-radius: 13px; background: var(--strong); color: var(--on-strong); font-size: 12px; font-weight: 700; box-shadow: var(--shadow-pop); }
.tl-drop { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--orange); z-index: 10; pointer-events: none; }

/* aba "Folha": modelo editável + prévia A4 */
.folha-ed { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.folha-form { display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); padding: 16px; }
.folha-form .duo { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.folha-form textarea.in { resize: vertical; min-height: 60px; font: inherit; }
.folha-form input[type=range] { width: 100%; accent-color: var(--orange); }
.folha-campos { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; }
.folha-campos legend { font-size: 12px; font-weight: 600; color: var(--text2); padding: 0 6px; }
.folha-campos label { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.folha-acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.folha-prev { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: #D9D4C7; padding: 14px; overflow: hidden; }
.folha-escala { position: relative; margin: 0 auto; }
.folha-escala iframe { position: absolute; left: 0; top: 0; width: 794px; height: 1123px; border: 0; background: #fff; transform-origin: 0 0; box-shadow: 0 3px 16px rgba(0,0,0,.3); }
@media (max-width: 980px) { .folha-ed { grid-template-columns: 1fr; } }

/* tempo estimado: início/fim, comum ou por instalador */
.tempo { display: flex; flex-direction: column; gap: 6px; }
.tempo-topo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tempo-topo .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.tempo-par { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.tempo-par[hidden], .tempo-inst[hidden], .tempo-topo .chk[hidden] { display: none; }
.tempo-par label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text2); }
.tempo-inst { display: flex; flex-direction: column; gap: 8px; }
.tempo-inst .tempo-par { grid-template-columns: minmax(0, 1.3fr) 1fr 1fr; align-items: end; }
.tempo-inst .nm { display: flex; align-items: center; gap: 7px; min-height: 40px; font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; }
.tempo-inst .nm .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.tl-vazio { padding: 22px 16px; color: var(--text2); text-align: center; }
.tl-vazio b { color: var(--text); }

.inst-edit.excluindo { flex-wrap: wrap; background: var(--st-cancelado-bg); border: 1px solid var(--st-cancelado-borda); border-radius: 10px; padding: 10px; }
.inst-edit.excluindo p { flex: 1 1 100%; font-size: 13px; }
.inst-edit .grow { flex: 1; }
.btn.icone { width: 36px; min-height: 36px; padding: 0; flex: none; }
.btn.perigo { background: var(--red); border-color: var(--red); color: #fff; }
.btn.perigo:hover { background: #8f1e18; }
