/* HelpSourceIT — estilos base */
:root {
  --bg: #040a16;
  --bg-2: #071122;
  --panel: rgba(9, 20, 40, .78);
  --panel-solid: #0a1529;
  --line: #17325c;
  --line-strong: #2a5ea6;
  --text: #eaf2ff;
  --muted: #9db0cc;
  --primary: #1e90ff;
  --cyan: #19c3ff;
  --grad: linear-gradient(90deg, #12c2ff 0%, #1a7dff 60%, #1557e8 100%);
  --red: #ff4d4f;
  --green: #22d36b;
  --orange: #ff9a1f;
  --yellow: #f2c418;
  --purple: #7b2ff7;
  --radius: 12px;
  --font: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
i[data-icon] { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; }

/* ---------- Layout do app ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: calc(100vh / var(--z, 1)); }
.app.collapsed { grid-template-columns: 84px 1fr; }

.sidebar {
  position: sticky; top: 0; height: calc(100vh / var(--z, 1)); overflow: hidden;
  background: linear-gradient(180deg, #071226 0%, #040b18 100%);
  border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; z-index: 20;
}
.sidebar::after { /* feixe de luz azul no rodapé */
  content: ""; position: absolute; left: -40%; bottom: -12%; width: 160%; height: 42%;
  background:
    radial-gradient(60% 40% at 30% 70%, rgba(30, 144, 255, .55), transparent 70%),
    radial-gradient(90% 18% at 40% 80%, rgba(25, 195, 255, .35), transparent 70%);
  transform: rotate(-28deg); filter: blur(8px); pointer-events: none;
}
.sidebar .brand { display: flex; justify-content: center; padding: 0 6px 22px; }
.sidebar .brand img { width: 186px; height: auto; }
.nav { list-style: none; margin: 0; padding: 0; position: relative; z-index: 1; }
.nav a {
  display: flex; align-items: center; gap: 16px; padding: 14px 16px; margin-bottom: 6px;
  color: var(--text); font-weight: 600; font-size: 19px; border-radius: 10px; white-space: nowrap;
}
.nav a i[data-icon] { width: 26px; height: 26px; }
.nav a .chev { margin-left: auto; width: 20px; height: 20px; }
.nav a:hover { background: rgba(30, 144, 255, .12); }
.nav a.active { background: linear-gradient(90deg, #1584ff, #1e90ff); box-shadow: 0 0 22px rgba(30, 144, 255, .45); }
.nav hr { border: 0; border-top: 2px solid #22406e; margin: 14px 12px 18px; }
.subnav { list-style: none; margin: -2px 0 8px; padding: 4px 0 6px 18px; border-left: 2px solid #22406e; margin-left: 28px; }
.subnav .sub-h { color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 10px 10px 4px; }
.subnav a { font-size: 16px !important; font-weight: 500 !important; padding: 8px 12px !important; margin-bottom: 2px !important; }
.subnav a.on { background: rgba(30, 144, 255, .18); color: #fff; }
.nav a[aria-expanded="true"] .chev { transform: rotate(180deg); }
.app.collapsed .subnav { display: none; }
.app.collapsed .nav a span, .app.collapsed .nav a .chev, .app.collapsed .brand img { display: none; }
.sidebar { overflow-y: auto; }
.brand { text-decoration: none; }
/* ---------- Tabela de cadastros (visual de sistema, não de planilha) ---------- */
.cad-wrap { border: 1px solid var(--line); border-radius: 14px; overflow: auto; max-height: calc(100vh / var(--z, 1) - 78px - 290px); min-height: 280px; background: rgba(6, 14, 30, .6); }
.tbl-cad { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl-cad th { position: sticky; top: 0; z-index: 2; background: #0c1a34; text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: #9fb3d1; padding: 13px 16px; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
.tbl-cad th.th-sort:hover { color: #fff; }
.tbl-cad th i[data-icon] { width: 14px; height: 14px; vertical-align: -2px; opacity: .6; }
.tbl-cad td { padding: 12px 16px; border-bottom: 1px solid rgba(23, 50, 92, .55); vertical-align: middle; font-size: 15px; color: #dce7f7; }
.tbl-cad tbody tr { transition: background .12s; }
.tbl-cad tbody tr.clic { cursor: pointer; }
.tbl-cad tbody tr:hover td { background: rgba(30, 144, 255, .07); }
.tbl-cad tbody tr.inativo td { opacity: .55; }
.ell { display: block; max-width: var(--w, 260px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.cel-prin { display: flex; gap: 12px; align-items: center; min-width: 220px; max-width: 300px; }
.cel-prin > div { min-width: 0; }
.cel-prin b { display: block; color: #fff; font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; flex: none;
  background: linear-gradient(135deg, hsl(var(--h) 65% 45%), hsl(calc(var(--h) + 30) 70% 32%)); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.pessoa { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pessoa .av { width: 28px; height: 28px; border-radius: 50%; font-size: 11px; box-shadow: none; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: hsl(var(--h) 70% 50% / .14); color: hsl(var(--h) 85% 74%); border: 1px solid hsl(var(--h) 70% 55% / .35); }
.mais { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--muted); font-size: 12px; }
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.st.off::before { background: #6d7a90; box-shadow: none; }
.acoes-cel { white-space: nowrap; text-align: right; width: 1%; position: sticky; right: 0; z-index: 1; background: #081326; box-shadow: -10px 0 12px -8px rgba(0, 0, 0, .6); }
.tbl-cad th:last-child { position: sticky; right: 0; z-index: 3; }
.tbl-cad tbody tr:hover td.acoes-cel { background: #0c1a34; }
.ib { width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: #8ea3c4; display: inline-grid; place-items: center; cursor: pointer; margin-left: 2px; }
.ib i[data-icon] { width: 18px; height: 18px; }
.ib:hover { background: #0f2142; border-color: var(--line-strong); color: #fff; }
.ib.del:hover { border-color: rgba(255, 77, 79, .6); color: #ff8587; }
.ib.conf { width: auto; padding: 0 10px; border-color: var(--red); color: #ff8587; font-size: 13px; font-weight: 700; }
.cad-resumo { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cad-resumo .chip { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: rgba(9, 20, 40, .8); border: 1px solid var(--line); }
.cad-resumo .chip b { font-size: 22px; color: #fff; font-variant-numeric: tabular-nums; }
.cad-resumo .chip span { color: var(--muted); font-size: 13.5px; line-height: 1.2; }
.cad-resumo .chip.alerta b { color: #ffc078; }
.cad-filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.cad-filtros .select, .cad-filtros .input { height: 42px; width: auto; min-width: 170px; }
.vazio-cel { color: #5f6f88; }

/* Formulário de cadastro em modal */
.cad-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.cad-form .largo { grid-column: 1 / -1; }
.cad-form label > span { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.cad-form small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.cad-multi { max-height: 220px; overflow: auto; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.th-sort { cursor: pointer; user-select: none; }
.pag { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-top: 12px; color: var(--muted); flex-wrap: wrap; }
@media (max-width: 700px) { .cad-form, .cad-multi { grid-template-columns: 1fr; } }
.app.collapsed .nav a { justify-content: center; padding: 14px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: 78px; display: flex; align-items: center; gap: 18px; padding: 0 22px 0 30px;
  background: #050d1d; border-bottom: 1px solid var(--line); overflow: visible; /* visível: o menu do usuário abre para baixo */
}
.topbar-luz { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.topbar-luz::before { /* feixe de luz (recortado aqui, sem cortar o menu do usuário) */
  content: ""; position: absolute; left: 32%; top: -60px; width: 340px; height: 190px;
  background: radial-gradient(50% 30% at 50% 50%, rgba(80, 170, 255, .7), transparent 70%);
  transform: rotate(-38deg); filter: blur(6px); pointer-events: none;
}
.topbar > *:not(.topbar-luz) { position: relative; }
.icon-btn { background: none; border: 0; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: var(--text); }
.icon-btn i[data-icon] { width: 26px; height: 26px; }
.icon-btn:hover { background: rgba(255, 255, 255, .06); }
.icon-btn.round { background: #0b1830; }
.topbar .title { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 700; padding-left: 18px; border-left: 1px solid var(--line); }
.topbar .title i[data-icon] { width: 32px; height: 32px; color: var(--primary); }
.topbar .spacer { flex: 1; }
.bell { position: relative; }
.bell::after { content: ""; position: absolute; top: 9px; right: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 6px var(--red); }
.topbar .divider { width: 1px; height: 40px; background: var(--line); }
.user { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 17px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 18px; box-shadow: 0 0 14px rgba(30, 144, 255, .5); }

.content { padding: 22px 18px 28px 22px; }
.page-head { display: flex; align-items: center; gap: 22px; padding: 4px 4px 22px; border-bottom: 1px solid var(--line); margin: 0 -18px 18px -22px; padding-left: 26px; }
.page-head .big-ico { width: 58px; height: 58px; color: var(--primary); }
.page-head h1 { margin: 0; font-size: 34px; font-weight: 700; line-height: 1.1; }
.page-head p { margin: 4px 0 0; color: #d7e3f6; font-size: 17px; }
.back-btn { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line-strong); background: #081429; display: grid; place-items: center; color: var(--text); cursor: pointer; }
.back-btn i[data-icon] { width: 26px; height: 26px; }
.vsep { width: 1px; align-self: stretch; background: var(--line); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 18px; border-radius: 10px;
  border: 1.5px solid transparent; background: #0b1830; color: var(--text); font-weight: 600; font-size: 17px; cursor: pointer; white-space: nowrap;
}
.btn i[data-icon] { width: 22px; height: 22px; }
.btn-primary { background: linear-gradient(180deg, #1e9bff, #1467f0); border-color: #4fb0ff; box-shadow: 0 0 16px rgba(30, 144, 255, .45); }
.btn-outline { background: rgba(14, 58, 140, .35); border-color: #2f7bff; box-shadow: 0 0 12px rgba(47, 123, 255, .35) inset; }
.btn-purple { background: linear-gradient(180deg, #8a3dff, #6a1ff0); border-color: #a06bff; }
.btn-ghost { background: transparent; border-color: #8aa0c0; }
.btn:hover { filter: brightness(1.12); }

/* ---------- Abas segmentadas ---------- */
.seg { display: inline-flex; background: #081429; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 0 22px; height: 44px; border-radius: 9px; font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.seg button.on { background: linear-gradient(180deg, #2cb6ff, #1490ff); box-shadow: 0 0 14px rgba(30, 160, 255, .55); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(150px, 172px)) repeat(3, minmax(190px, 1fr)); gap: 10px; margin: 22px 0 20px; }
.kpi { border-radius: 10px; border: 2px solid; padding: 12px 10px; text-align: center; min-height: 114px; display: flex; flex-direction: column; justify-content: center; }
.kpi .n { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 44px; font-weight: 800; line-height: 1; }
.kpi .n i[data-icon] { width: 30px; height: 30px; }
.kpi .l { margin-top: 8px; font-size: 17px; }
.kpi.txt { font-size: 16px; line-height: 1.4; text-align: center; }
.kpi.txt i[data-icon] { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
.k-red { border-color: var(--red); background: linear-gradient(180deg, rgba(255, 77, 79, .12), rgba(255, 77, 79, .03)); }
.k-red .n { color: var(--red); }
.k-blue { border-color: #2f8cff; background: linear-gradient(180deg, rgba(47, 140, 255, .14), rgba(47, 140, 255, .03)); }
.k-blue .n { color: #cfe6ff; } .k-blue .n i { color: #5aaaff; }
.k-green { border-color: var(--green); background: linear-gradient(180deg, rgba(34, 211, 107, .12), rgba(34, 211, 107, .03)); }
.k-green .n { color: #d8ffe6; } .k-green .n i { color: var(--green); }
.k-orange { border-color: var(--orange); background: linear-gradient(180deg, rgba(255, 154, 31, .12), rgba(255, 154, 31, .03)); }
.k-orange .n { color: var(--yellow); }
.k-yellow { border-color: var(--yellow); background: linear-gradient(180deg, rgba(242, 196, 24, .1), rgba(242, 196, 24, .02)); }
.k-yellow i { color: var(--yellow); }
.k-orange.txt i { color: var(--orange); }
.k-green.txt i { color: var(--green); }
.k-green.txt b { color: var(--green); font-weight: 500; }

/* ---------- Tabela ---------- */
.table-wrap { border: 1px solid var(--line-strong); border-radius: 12px; overflow: auto; background: rgba(6, 14, 30, .85); }
table.grid { width: 100%; border-collapse: collapse; min-width: 1100px; }
.grid th { background: #0d1d3a; font-weight: 700; font-size: 17px; text-align: center; padding: 16px 12px; white-space: nowrap; }
.grid th i[data-icon] { width: 16px; height: 16px; vertical-align: -2px; margin-left: 4px; color: #b8cae4; }
.grid th:first-child, .grid td:first-child { width: 58px; text-align: center; }
.grid td { padding: 14px 12px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); vertical-align: top; font-size: 17px; }
.grid td:first-child { border-left: 0; }
.grid tr td:first-child { box-shadow: inset 3px 0 0 #2f6bd8; }
.grid tr.st-green td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.grid .code { color: var(--cyan); font-weight: 700; }
.grid .cli b { display: block; font-weight: 700; }
.grid .cli small { display: block; color: #d0dcef; font-size: 14.5px; margin-top: 4px; max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid .c { text-align: center; }
.grid .dt { white-space: nowrap; }
.edit-col { width: 64px; }
.edit-btn { width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid #2f8cff; background: rgba(30, 144, 255, .12); color: #5fb2ff; display: grid; place-items: center; cursor: pointer; margin: 0 auto; }
.edit-btn i[data-icon] { width: 22px; height: 22px; }

/* ---------- Checkbox / radio ---------- */
.chk { appearance: none; width: 22px; height: 22px; border: 2px solid #c7d4e8; border-radius: 4px; background: transparent; cursor: pointer; display: inline-grid; place-items: center; margin: 0; vertical-align: middle; }
.chk:checked { background: var(--primary); border-color: var(--primary); }
.chk:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.radio { appearance: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #c7d4e8; cursor: pointer; margin: 0; display: inline-grid; place-items: center; }
.radio:checked { border-color: var(--primary); }
.radio:checked::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.opt { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; cursor: pointer; }

/* ---------- Formulário ---------- */
.tabs { display: flex; gap: 4px; padding: 0 0 0 0; border-bottom: 1px solid var(--line-strong); }
.tabs button { border: 0; background: #0a1730; padding: 0 30px; height: 54px; border-radius: 10px 10px 0 0; font-size: 18px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 12px; }
.tabs button i[data-icon] { width: 24px; height: 24px; }
.tabs button.on { background: linear-gradient(180deg, #2cb0ff, #1584ff); box-shadow: 0 0 16px rgba(30, 150, 255, .55); }
.form-shell { border: 1px solid var(--line-strong); border-radius: 18px; padding: 0 0 0 0; }
.form-shell .tabs { padding: 0; margin: 0 0 14px; }
.form-grid { display: grid; grid-template-columns: 456px 1fr; gap: 20px; }
.card { border: 1.5px solid var(--line-strong); border-radius: 18px; background: var(--panel); padding: 14px 24px; box-shadow: 0 0 20px rgba(30, 144, 255, .08) inset; }
.card h3 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.card section + section { border-top: 1px solid #284a7c; margin-top: 14px; padding-top: 14px; }
.radios { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.radios .opt:last-child { margin-left: auto; margin-right: 60px; }
.field { position: relative; display: flex; align-items: center; }
.input, .select, .textarea {
  width: 100%; height: 40px; border-radius: 6px; border: 1.5px solid #c6d3e7; background: #050d1c; color: var(--text); padding: 0 14px; font-size: 16px; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(25, 195, 255, .2); }
.field > i[data-icon] { position: absolute; left: 12px; width: 20px; height: 20px; pointer-events: none; color: #d5e2f5; }
.field.has-ico .input, .field.has-ico .select { padding-left: 42px; }
.select { appearance: none; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eaf2ff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; }
.select option { background: #0a1529; }
.textarea { height: 90px; padding: 12px 14px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #d0dcef; opacity: .9; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.lbl { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.lbl i[data-icon] { width: 22px; height: 22px; }
.req { color: var(--red); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.mt { margin-top: 22px; }
.checks { display: flex; gap: 120px; margin-top: 26px; }
.form-foot { display: flex; align-items: center; gap: 22px; border-top: 1px solid var(--line-strong); margin-top: 16px; padding-top: 12px; }
.form-foot .spacer { flex: 1; }
.form-foot .btn { height: 56px; font-size: 19px; padding: 0 24px; }
.placeholder-panel { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 18px; }

.user-menu { position: absolute; right: 0; top: 54px; min-width: 160px; background: #0b1b36; border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); z-index: 50; }
.user-menu button { white-space: nowrap; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 16px; }
.user-menu button:hover { background: rgba(30, 144, 255, .15); }

/* ---------- Status ---------- */
:root { --st-agendada: #f2c418; --st-atendimento: #22d36b; --st-concluida: #8f9bb0; --st-atrasada: #ff4d4f; --st-pendente: #ff9a1f; --st-cancelada: #a06bff; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.agendada { background: var(--st-agendada); } .dot.em_atendimento { background: var(--st-atendimento); }
.dot.concluida { background: var(--st-concluida); } .dot.atrasada { background: var(--st-atrasada); }
.dot.pendente { background: var(--st-pendente); } .dot.cancelada { background: var(--st-cancelada); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.badge.agendada { color: var(--st-agendada); border-color: rgba(242, 196, 24, .5); background: rgba(242, 196, 24, .08); }
.badge.em_atendimento { color: var(--st-atendimento); border-color: rgba(34, 211, 107, .5); background: rgba(34, 211, 107, .08); }
.badge.concluida { color: #c3cbd8; border-color: rgba(143, 155, 176, .5); background: rgba(143, 155, 176, .08); }
.badge.atrasada { color: #ff7a7c; border-color: rgba(255, 77, 79, .55); background: rgba(255, 77, 79, .1); }
.badge.pendente { color: var(--st-pendente); border-color: rgba(255, 154, 31, .5); background: rgba(255, 154, 31, .08); }
.badge.cancelada { color: #c4a6ff; border-color: rgba(160, 107, 255, .5); background: rgba(160, 107, 255, .08); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.grid tr.st-atrasada td:first-child { box-shadow: inset 3px 0 0 var(--st-atrasada); }
.grid tr.st-em_atendimento td:first-child { box-shadow: inset 3px 0 0 var(--st-atendimento); }
.grid tr.st-concluida td:first-child { box-shadow: inset 3px 0 0 var(--st-concluida); }
.grid tr.st-pendente td:first-child { box-shadow: inset 3px 0 0 var(--st-pendente); }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: rgba(30, 144, 255, .05); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 17px; }
.mini-btn { height: 32px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-strong); background: #0b1830; color: var(--text); cursor: pointer; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.mini-btn:hover { border-color: var(--cyan); }
.mini-btn.go { border-color: rgba(34, 211, 107, .6); color: #8ff0b6; }
.mini-btn.done { border-color: rgba(30, 144, 255, .6); color: #8cc6ff; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.toolbar2 { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar2 .input, .toolbar2 .select { width: auto; min-width: 180px; height: 44px; }

/* ---------- Calendário mensal ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head h2 { margin: 0 8px; font-size: 24px; min-width: 220px; }
.cal { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: rgba(6, 14, 30, .85); }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); background: #0d1d3a; }
.cal-week div { text-align: center; padding: 8px 0; color: var(--muted); font-size: 13px; letter-spacing: .08em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day { min-height: 118px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px 6px 8px; min-width: 0; }
.cal-day:nth-child(7n+1) { border-left: 0; }
.cal-day.fora { background: rgba(0, 0, 0, .25); }
.cal-day.fora .num { opacity: .4; }
.cal-day.hoje .num { background: var(--primary); color: #fff; border-radius: 6px; padding: 0 7px; }
.cal-day .num { display: inline-block; font-size: 16px; margin-bottom: 4px; }
.cal-ev { display: flex; align-items: center; gap: 5px; width: 100%; background: none; border: 0; padding: 2px 2px; text-align: left; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; border-radius: 4px; }
.cal-ev:hover { background: rgba(30, 144, 255, .14); }
.cal-ev b { font-weight: 700; }
.cal-ev .t { overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 13px; color: var(--cyan); background: none; border: 0; cursor: pointer; padding: 2px; }

/* ---------- Linha do tempo ---------- */
.tl { border: 1px solid var(--line-strong); border-radius: 12px; overflow: auto; background: rgba(6, 14, 30, .85); }
.tl-inner { min-width: 1100px; position: relative; }
.tl-row { display: grid; grid-template-columns: 200px 1fr; border-top: 1px solid var(--line); min-height: 64px; }
.tl-row:first-child { border-top: 0; }
.tl-name { padding: 12px 14px; font-weight: 600; border-right: 1px solid var(--line); display: flex; align-items: center; }
.tl-track { position: relative; }
.tl-hours { display: grid; grid-template-columns: 200px 1fr; background: #0d1d3a; }
.tl-hours .h { position: relative; height: 34px; }
.tl-hours .h span { position: absolute; top: 8px; transform: translateX(-50%); font-size: 12.5px; color: var(--muted); }
.tl-block { position: absolute; top: 10px; height: 44px; border-radius: 8px; padding: 4px 8px; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; border: 1px solid; background: rgba(242, 196, 24, .12); border-color: rgba(242, 196, 24, .6); }
.tl-block.em_atendimento { background: rgba(34, 211, 107, .14); border-color: rgba(34, 211, 107, .7); }
.tl-block.concluida { background: rgba(143, 155, 176, .14); border-color: rgba(143, 155, 176, .6); }
.tl-block.atrasada { background: rgba(255, 77, 79, .14); border-color: rgba(255, 77, 79, .7); }
.tl-block.pendente { background: rgba(255, 154, 31, .14); border-color: rgba(255, 154, 31, .7); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); pointer-events: none; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 4, 12, .7); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { width: min(760px, 100%); max-height: calc(100vh / var(--z, 1) - 32px); overflow: auto; background: #081429; border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 30px rgba(30, 144, 255, .2); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-size: 21px; flex: 1; }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; font-size: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #0b1b36; border: 1px solid var(--line-strong); border-radius: 8px; max-height: 260px; overflow: auto; z-index: 30; }
.ac-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; cursor: pointer; }
.ac-list button:hover, .ac-list button.on { background: rgba(30, 144, 255, .18); }
.ac-list small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Atendimento WhatsApp ---------- */
.wa { display: grid; grid-template-columns: 380px 1fr; gap: 16px; height: calc(100vh / var(--z, 1) - 78px - 150px); min-height: 520px; }
.wa-col { border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(6, 14, 30, .85); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wa-filtros { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wa-filtros button { border: 1px solid var(--line-strong); background: #0b1830; border-radius: 999px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; }
.wa-filtros button.on { background: var(--primary); border-color: var(--primary); }
.wa-lista { overflow: auto; flex: 1; }
.wa-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; cursor: pointer; }
.wa-item:hover, .wa-item.on { background: rgba(30, 144, 255, .1); }
.wa-item .l1 { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.wa-item .l1 .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item .l1 time { font-weight: 400; color: var(--muted); font-size: 13px; }
.wa-item .l2 { color: var(--muted); font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item .l3 { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--green); color: #031; font-size: 12.5px; font-weight: 800; display: inline-grid; place-items: center; }
.st-wa { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.st-wa.robo { color: #c4a6ff; border-color: rgba(160, 107, 255, .5); }
.st-wa.aguardando { color: #ff8587; border-color: rgba(255, 77, 79, .6); background: rgba(255, 77, 79, .1); }
.st-wa.em_atendimento { color: #8ff0b6; border-color: rgba(34, 211, 107, .5); }
.st-wa.encerrada { color: #c3cbd8; border-color: rgba(143, 155, 176, .5); }
.wa-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wa-head h3 { margin: 0; font-size: 19px; }
.wa-head small { color: var(--muted); display: block; font-size: 14px; }
.wa-head .sp { flex: 1; }
.wa-info { margin: 10px 16px 0; padding: 10px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 14.5px; color: #d3def0; }
.wa-info b { color: var(--text); }
.wa-msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bolha { max-width: 72%; padding: 8px 12px; border-radius: 12px; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.bolha small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.bolha.entrada { align-self: flex-start; background: #12213d; border: 1px solid var(--line); }
.bolha.saida { align-self: flex-end; background: #0c3a2a; border: 1px solid rgba(34, 211, 107, .35); }
.bolha.robo { background: #22184a; border-color: rgba(160, 107, 255, .4); }
.bolha.sistema { background: #0d2b4f; border-color: rgba(30, 144, 255, .5); }
.bolha.erro { border-color: var(--red); }
.wa-enviar { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
.wa-enviar textarea { flex: 1; height: 52px; resize: none; }
.wa-vazio { flex: 1; display: grid; place-items: center; color: var(--muted); font-size: 17px; text-align: center; padding: 20px; }
.nav a .cnt { margin-left: auto; min-width: 24px; height: 24px; border-radius: 12px; background: var(--red); font-size: 13px; display: grid; place-items: center; padding: 0 6px; }
@media (max-width: 900px) { .wa { grid-template-columns: 1fr; height: auto; } .wa-col { min-height: 420px; } }

.loc-selo { font-size: 18px; margin-right: -4px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Mapa de Operação ---------- */
.op-mapa { height: calc(100vh / var(--z, 1) - 78px - 190px); min-height: 480px; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; position: relative; }
#mapa { position: absolute; inset: 0; background: #0b1530; }
/* O mapa não usa a escala automática (evita frestas entre os tiles e mantém o clique preciso) */
#mapa { zoom: calc(1 / var(--z, 1)); }
.op-painel { position: absolute; top: 12px; right: 12px; z-index: 500; width: 360px; max-height: calc(100% - 24px); overflow: auto; background: rgba(8, 20, 41, .96); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.op-painel .cab { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.op-painel .cab h3 { margin: 0; font-size: 17px; flex: 1; }
.op-painel .corpo { padding: 12px 14px; font-size: 14.5px; }
.op-vis { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.op-vis .l1 { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.op-vis .l2 { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.op-vis a { font-size: 13px; margin-right: 10px; }
.op-legenda { position: absolute; left: 12px; bottom: 26px; z-index: 500; background: rgba(8, 20, 41, .92); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 14px; max-width: calc(100% - 24px); }
.op-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.op-aviso { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 600; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.mk-tec { width: 38px; height: 38px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); display: grid; place-items: center; }
.mk-tec b { transform: rotate(45deg); color: #fff; font: 800 16px/1 var(--font); }
.mk-tec.velho { filter: grayscale(.85); opacity: .75; }
.mk-cli { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, var(--c) 0 3px, #fff 3.5px 6px, var(--c) 6.5px 9px, #fff 9.5px 11px, var(--c) 11.5px 13px); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.mk-cli.sem { opacity: .7; transform: scale(.8); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0b1b36; color: var(--text); }
.leaflet-container a.leaflet-popup-close-button { color: #cfe0f5; }
@media (max-width: 900px) { .op-painel { width: auto; left: 12px; } }

/* ---------- Toast ---------- */
.toast { position: fixed; right: 24px; bottom: 24px; background: #0b1b36; border: 1px solid var(--primary); padding: 14px 18px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); opacity: 0; transform: translateY(10px); transition: .25s; z-index: 100; max-width: 380px; }
.toast.show { opacity: 1; transform: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .25s; }
  .app.mobile-open .sidebar { transform: none; }
  .app.collapsed .nav a span, .app.collapsed .nav a .chev, .app.collapsed .brand img { display: revert; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .title { font-size: 22px; padding-left: 10px; }
  .topbar .user span, .topbar .divider, .topbar .hide-sm { display: none; }
  .content { padding: 16px; }
  .page-head { margin: 0 -16px 16px; padding-left: 16px; }
  .page-head h1 { font-size: 26px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .row3, .row2 { grid-template-columns: 1fr; gap: 16px; }
  .checks { flex-direction: column; gap: 16px; }
  .tabs { overflow-x: auto; }
  .tabs button { padding: 0 16px; white-space: nowrap; }
  .form-foot { flex-wrap: wrap; }
}

/* ---------- Celular (até 700px): nada pode passar da largura da tela ---------- */
.kpis.k5 { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.barra-v { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.barra-v > div[style*="flex:1"] { flex: 1; }
.busca-v { min-width: 320px; flex: 1; max-width: 520px; }
@media (max-width: 700px) {
  .content { padding: 12px; }
  .page-head { gap: 12px; margin: 0 -12px 12px; padding: 4px 12px 14px; }
  .page-head .big-ico { width: 40px; height: 40px; flex: none; }
  .page-head h1 { font-size: 24px; }
  .page-head p { font-size: 14.5px; }
  .page-head .btn { height: 40px; padding: 0 12px; font-size: 15px; }
  .barra-v { gap: 10px; }
  .barra-v .seg { width: 100%; }
  .seg button { flex: 1; padding: 0 8px; height: 40px; font-size: 15px; white-space: nowrap; justify-content: center; }
  .barra-v > div[style*="flex:1"] { display: none; }
  .barra-v .btn { flex: 1; justify-content: center; height: 42px; }
  /* indicadores compactos em linha (sem quadros grandes) */
  .kpis, .kpis.k5 { grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
  .kpis .kpi { min-height: 0; padding: 8px 10px; flex-direction: row; justify-content: space-between; align-items: center; text-align: left; border-width: 1px; }
  .kpis .kpi .n { font-size: 22px; order: 2; gap: 6px; }
  .kpis .kpi .n i[data-icon] { width: 18px; height: 18px; }
  .kpis .kpi .l { margin: 0; font-size: 14px; }
  .kpis.k5 .kpi:last-child { grid-column: 1 / -1; }
  .toolbar2 { gap: 8px; }
  .toolbar2 .select, .busca-v { min-width: 0; width: 100%; max-width: none; flex: 1 1 100%; }
  /* tabela vira cartões */
  .table-wrap { overflow: visible; }
  table.grid { min-width: 0; }
  .grid thead { display: none; }
  .grid tbody tr { display: block; padding: 12px 14px; border-top: 1px solid var(--line); border-left: 4px solid #2f6bd8; }
  .grid tbody tr:first-child { border-top: 0; }
  .grid tbody tr.st-atrasada { border-left-color: var(--st-atrasada); }
  .grid tbody tr.st-em_atendimento { border-left-color: var(--st-atendimento); }
  .grid tbody tr.st-concluida { border-left-color: var(--st-concluida); }
  .grid tbody tr.st-pendente { border-left-color: var(--st-pendente); }
  .grid td, .grid td:first-child { display: flex; gap: 10px; align-items: baseline; width: auto; padding: 3px 0; border: 0; box-shadow: none !important; text-align: left; font-size: 15px; }
  .grid td[data-l]::before { content: attr(data-l); flex: 0 0 96px; color: var(--muted); font-size: 13px; }
  .grid td.code { font-size: 14px; }
  .grid td.cli { display: block; padding-bottom: 6px; }
  .grid .cli small { max-width: none; white-space: normal; }
  .grid td.desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .grid td.desc::before { content: none; }
  .grid td.sem-acoes { display: none; }
  .grid td.empty { display: block; text-align: center; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .modal { width: calc(100vw - 24px) !important; }
}
@media (max-width: 700px) {
  .toolbar2 .busca-v { flex: 1 1 100% !important; width: 100% !important; }
}

/* ---------- Dica de instalação no iPhone ---------- */
.dica-ios { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 120; display: flex; gap: 10px; align-items: flex-start;
  background: #0b1b36; border: 1px solid var(--primary); border-radius: 12px; padding: 12px 12px 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); font-size: 15px; line-height: 1.45; }
.dica-ios > div { flex: 1; }
.dica-ios button { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 2px 6px; cursor: pointer; }
.dica-ios .ic-share { display: inline-block; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 5px; font-size: 13px; }
