/* Cavalcante Fluxo v6 — camada de identidade (azul institucional) + módulo Campanhas e TVs.
 * Carregada depois de style.css: troca cores e componentes sem alterar a estrutura das
 * telas operacionais (recepção e profissional). */
:root {
  --navy: var(--brand-dark); --deep: var(--brand-dark2); --blue: var(--brand); --blue-700: var(--brand-700); --sky: var(--tint2);
  --green: #00B968; --green-700: #00804A; --gray: var(--brand-muted); --amber: #B7791F; --red: #C2413B;
  --ink: #161B18; --muted: #5C6A63; --line: var(--tint-line); --canvas: var(--tint); --surface: #FFFFFF;
  --radius: 14px; --shadow: 0 1px 2px rgba(14, 36, 64, .05), 0 8px 24px rgba(14, 36, 64, .06);
  --focus: var(--brand);
  font-family: "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--canvas);
}
body.app-body { background: var(--canvas); }

/* ---------- shell */
.sidebar { background: var(--navy); }
.side-brand .brand-mark, .brand-mark { background: var(--blue); box-shadow: none; }
.brand-mark span { color: #fff; }
.side-brand span { color: var(--accent-soft); }
.side-section { color: var(--brand-muted); }
.side-section.nav-group { padding-top: 18px; }
.sidebar nav { overflow-y: auto; }
.sidebar nav button, .sidebar nav a { color: var(--brand-muted); min-height: 42px; padding: 10px 14px; }
.sidebar nav button span, .sidebar nav a span { color: var(--accent-soft); }
.sidebar nav button:hover, .sidebar nav a:hover { background: rgba(232, 244, 255, .08); color: #fff; }
.sidebar nav button.selected { background: var(--sky); color: var(--navy); }
.sidebar nav button.selected span { color: var(--blue); }
.status-dot, .live-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(0, 185, 104, .18); }
.side-footer small { color: var(--brand-muted); }
.topbar { background: #fff; border-bottom-color: var(--line); }
.breadcrumb b { color: var(--ink); }
.top-actions { text-transform: none; }
#today { display: inline-block; }
#today::first-letter { text-transform: uppercase; }
.user-pill { border-color: var(--line); background: var(--canvas); color: var(--ink); }
.text-button { color: var(--blue); }
.eyebrow { color: var(--blue); }
.page-heading h1 { color: var(--ink); }
.primary { background: var(--blue); box-shadow: 0 6px 16px rgba(20, 121, 201, .22); }
.primary:hover, .mini-primary:hover { background: var(--blue-700); }
.mini-primary { background: var(--blue); border-color: var(--blue); }
.mini-button { color: var(--blue-700); border-color: var(--tint-line); }
.mini-button.danger { color: var(--red); border-color: #F0C9C6; }
.metric, .card, .table-wrap, .empty-state, .filter-bar { border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.metric strong { color: var(--ink); }
.demo-banner { background: var(--tint); border-color: var(--tint-line); color: var(--brand-700); }
.demo-banner p { color: var(--brand); }
.badge.chamado { background: var(--tint); color: var(--blue-700); }
.ticket-cell { color: var(--deep); }
.login-card h1 em { color: var(--blue); }
.login-art { background: radial-gradient(circle at 75% 25%, var(--brand) 0, var(--brand-dark2) 40%, var(--navy) 78%); }
.art-line span { background: var(--green); }
.ticket-result { background: var(--deep); }
.room-preview { border-left-color: var(--blue); background: var(--tint); color: var(--brand-700); }
.form-icon { background: var(--tint); color: var(--blue); }
.reception-side { background: var(--tint); border-color: var(--tint-line); }
.next-visit { background: var(--tint); border-color: var(--tint-line); }
.count-pill { background: var(--tint); color: var(--blue-700); }
#notice { background: var(--deep); }
#notice.bad { background: var(--red); }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- module */
.sg { display: grid; gap: 18px; }
.sg-loading { padding: 40px; text-align: center; color: var(--muted); }
.sg-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.sg-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font-weight: 650; font-size: 14px; padding: 10px 16px; border-radius: 10px; min-height: 42px; cursor: pointer; white-space: nowrap; }
.sg-btn:hover { background: var(--blue-700); border-color: var(--blue-700); }
.sg-btn.ghost { background: #fff; color: var(--blue-700); border-color: var(--tint-line); }
.sg-btn.ghost:hover { background: var(--tint); }
.sg-btn.danger { background: var(--red); border-color: var(--red); }
.sg-btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.sg-btn[aria-pressed="true"] { background: #FFF4E0; border-color: var(--amber); color: #7A4E0E; }
.sg-link { border: 0; background: none; color: var(--blue-700); font-weight: 650; font-size: 13px; cursor: pointer; padding: 6px 4px; }
.sg-link.danger { color: var(--red); }
.sg-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; background: var(--tint2); color: #46524B; }
.sg-ok, .sg-ativa { background: #E2F6EC; color: var(--green-700); }
.sg-bad { background: #FBEAE9; color: var(--red); }
.sg-warn, .sg-pausada { background: #FFF4E0; color: #8A5A12; }
.sg-info, .sg-agendada { background: var(--tint); color: var(--blue-700); }
.sg-violet { background: #EEEAFB; color: #5B44B0; }
.sg-muted, .sg-rascunho, .sg-encerrada { background: var(--tint2); color: #5C6A63; }
.sg-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.sg-hint { display: block; font-size: 12px; line-height: 1.4; margin-top: 6px; }
.sg-hint.warn { color: #8A5A12; }
.sg-hint.good { color: var(--green-700); }
.sg-none, .sg-none-box { color: var(--muted); font-size: 13px; padding: 12px 0; list-style: none; }
.sg-none-box { border: 1px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; }
.sg-empty .sg-btn { margin-top: 12px; }
.sg-demo-banner { background: #FFF7E6; border: 1px solid #F2D9A6; color: #6B4A12; border-radius: 12px; padding: 12px 16px; font-size: 13px; font-weight: 600; }

/* dashboard */
.sg-kpi.blue strong { color: var(--blue); }
.sg-kpi.green strong { color: var(--green-700); }
.sg-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; color: var(--muted); }
.sg-strip b { color: var(--ink); font-size: 15px; }
.sg-strip .warn b { color: var(--amber); }
.sg-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sg-list { list-style: none; margin: 10px 0 0; padding: 0; }
.sg-list li { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--tint2); }
.sg-list li > div { min-width: 0; flex: 1; }
.sg-list p { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.sg-list small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sg-list code, .sg-howto code, fieldset code { font-size: 11px; background: var(--tint2); padding: 2px 6px; border-radius: 6px; color: #3A4640; }

/* media */
.sg-drop { display: grid; gap: 6px; place-items: center; text-align: center; padding: 28px; border: 2px dashed var(--tint-line); border-radius: var(--radius); background: var(--tint); cursor: pointer; transition: background .15s, border-color .15s; }
.sg-drop:hover, .sg-drop.over { background: var(--tint); border-color: var(--blue); }
.sg-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sg-drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.sg-drop strong { font-size: 16px; color: var(--ink); }
.sg-drop span { font-size: 13px; color: var(--muted); max-width: 720px; line-height: 1.5; }
.sg-uploads { display: grid; gap: 6px; }
.sg-uploads:empty { display: none; }
.sg-upload { display: grid; grid-template-columns: minmax(0, 1fr) 200px 180px; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.sg-upload span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-upload.good small { color: var(--green-700); font-weight: 650; }
.sg-upload.bad small { color: var(--red); font-weight: 650; }
.sg-bar { height: 6px; border-radius: 99px; background: var(--tint2); overflow: hidden; }
.sg-bar i { display: block; height: 100%; background: var(--blue); transition: width .2s; }
.sg-upload.good .sg-bar i { background: var(--green); }
.sg-upload.bad .sg-bar i { background: var(--red); }
.sg-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.sg-toolbar label { display: grid; gap: 6px; font-size: 12px; font-weight: 650; color: var(--muted); }
.sg-toolbar input, .sg-toolbar select { min-height: 42px; border: 1px solid var(--tint-line); border-radius: 10px; padding: 0 12px; font-size: 14px; background: #fff; color: var(--ink); }
.sg-search input { width: min(320px, 70vw); }
.sg-quota { margin-left: auto; display: grid; gap: 6px; min-width: 200px; font-size: 12px; color: var(--muted); }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.sg-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.sg-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; background: var(--deep); border: 0; padding: 0; cursor: pointer; overflow: hidden; }
.sg-thumb img, .sg-thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.sg-thumb.small { width: 92px; flex: none; border-radius: 8px; cursor: default; }
.sg-play { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(7, 29, 58, .8); color: #fff; display: grid; place-items: center; font-size: 11px; }
.sg-card-body { padding: 14px 14px 6px; display: grid; gap: 6px; flex: 1; }
.sg-card-body strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-card-body small { font-size: 11px; color: var(--muted); }
.sg-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.sg-card-foot { display: flex; justify-content: space-between; padding: 4px 10px 8px; border-top: 1px solid var(--tint2); }

/* tables */
.sg-table td { vertical-align: top; }
.sg-table td small { white-space: normal; }
.sg-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-air { color: var(--green-700) !important; font-weight: 700; }

/* dialog + forms */
.sg-dialog { border: 0; border-radius: 18px; padding: 24px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 30px 80px rgba(7, 29, 58, .35); color: var(--ink); }
.sg-dialog.wide { width: min(1000px, calc(100vw - 32px)); }
.sg-dialog.small { width: min(440px, calc(100vw - 32px)); }
.sg-dialog::backdrop { background: rgba(7, 29, 58, .55); }
.sg-dialog h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.sg-dialog p { line-height: 1.5; }
.sg-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.sg-dialog-head .eyebrow { margin-bottom: 4px; }
.sg-x { border: 0; background: var(--tint2); width: 36px; height: 36px; border-radius: 10px; font-size: 20px; cursor: pointer; color: var(--ink); flex: none; }
.sg-dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--tint2); }
.sg-form { display: grid; gap: 14px; }
.sg-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: #2F3B35; }
.sg-form label small, fieldset > small { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.4; }
.sg-form input:not([type=checkbox]):not([type=range]), .sg-form select, .sg-form textarea { width: 100%; min-height: 42px; border: 1px solid var(--tint-line); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--ink); background: #fff; }
.sg-form textarea { resize: vertical; }
.sg-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); padding: 0 6px; }
.sg-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sg-days { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-days label { display: block; }
.sg-days input { position: absolute; opacity: 0; }
.sg-days span { display: inline-block; padding: 8px 12px; border: 1px solid var(--tint-line); border-radius: 99px; font-size: 13px; cursor: pointer; }
.sg-days input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.sg-days input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.sg-check { display: flex !important; grid-template-columns: none; align-items: flex-start; gap: 10px !important; font-weight: 600; }
.sg-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--blue); }
.sg-check span { display: grid; gap: 2px; }
.sg-checks { display: flex; flex-wrap: wrap; gap: 14px 24px; }
.sg-devs { display: grid; gap: 8px; max-height: 160px; overflow: auto; }
.sg-code { font-size: 24px !important; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; text-align: center; }
.sg-items-box { gap: 10px; }
.sg-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: it; }
.sg-items li { display: grid; grid-template-columns: 92px minmax(0, 1fr) 150px 160px auto; gap: 12px; align-items: center; background: var(--tint); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.sg-items .sg-thumb.small { aspect-ratio: 16 / 10; }
.sg-item-main { min-width: 0; display: grid; gap: 2px; }
.sg-item-main strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-item-main small, .sg-muted-cell { font-size: 12px; color: var(--muted); }
.sg-items label { font-size: 11px !important; }
.sg-items select { min-height: 36px !important; padding: 4px 8px !important; font-size: 13px !important; }
.sg-order { display: flex; gap: 4px; }
.sg-order button { width: 34px; height: 34px; border: 1px solid var(--tint-line); background: #fff; border-radius: 8px; cursor: pointer; color: var(--ink); }
.sg-order button:disabled { opacity: .35; cursor: default; }
.sg-order button:last-child { color: var(--red); }
.sg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 60vh; overflow: auto; }
.sg-pick-item { position: relative; display: grid; gap: 6px; border: 2px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.sg-pick-item small { display: block; font-weight: 400; color: var(--muted); }
.sg-pick-item input { position: absolute; top: 14px; left: 14px; z-index: 1; width: 20px; height: 20px; accent-color: var(--blue); }
.sg-pick-item:has(input:checked) { border-color: var(--blue); background: var(--tint); }
.sg-pick-item .sg-thumb { border-radius: 8px; cursor: pointer; }
.sg-viewer { background: var(--deep); border-radius: 12px; overflow: hidden; display: grid; place-items: center; max-height: 60vh; }
.sg-viewer img, .sg-viewer video { max-width: 100%; max-height: 60vh; display: block; }
.sg-confirm p { color: var(--muted); }

/* playlists */
.sg-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.sg-pl-list { padding: 16px; display: grid; gap: 6px; }
.sg-pl-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sg-pl-list-head h2 { margin: 0; }
.sg-pl { display: grid; gap: 3px; text-align: left; border: 1px solid transparent; background: none; border-radius: 10px; padding: 10px 12px; cursor: pointer; color: var(--ink); }
.sg-pl:hover { background: var(--tint); }
.sg-pl.selected { background: var(--tint); border-color: var(--tint-line); }
.sg-pl strong { font-size: 14px; }
.sg-pl small { font-size: 12px; color: var(--muted); }
.sg-pl-status { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--muted); }
.sg-pl-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-spacer { flex: 1; }

/* devices */
.sg-howto { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.sg-howto ol { margin: 6px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.8; color: #2F3B35; }

/* preview */
.sg-preview { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.sg-stage-wrap { min-width: 0; }
.sg-stage { position: relative; overflow: hidden; border-radius: 14px; background: #000; box-shadow: 0 0 0 10px #10161F, 0 20px 50px rgba(7, 29, 58, .35); }
.sg-stage iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.sg-stage iframe:fullscreen { transform: none !important; width: 100vw !important; height: 100vh !important; }
.sg-preview-status { margin: 22px 0 0; font-size: 13px; color: var(--muted); min-height: 20px; }
.sg-controls { padding: 18px; display: grid; gap: 14px; }
.sg-controls label { display: grid; gap: 6px; font-size: 12px; font-weight: 650; color: var(--muted); }
.sg-controls input, .sg-controls select { min-height: 40px; border: 1px solid var(--tint-line); border-radius: 10px; padding: 0 10px; font-size: 14px; color: var(--ink); background: #fff; width: 100%; }
.sg-controls small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sg-btns { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1100px) {
  .sg-preview, .sg-split { grid-template-columns: 1fr; }
  .sg-items li { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .sg-items li label { grid-column: span 1; }
}
@media (max-width: 900px) {
  .sg-panels, .sg-form-grid { grid-template-columns: 1fr; }
  .sg-upload { grid-template-columns: 1fr; gap: 6px; }
  .sg-howto { flex-direction: column; align-items: flex-start; }
  .sidebar nav .side-section.nav-group { display: none; }
}
@media (max-width: 650px) {
  .sg-two { grid-template-columns: 1fr; }
  .sg-actions { justify-content: flex-start; margin-top: 12px; }
  .sg-quota { margin-left: 0; width: 100%; }
  .sg-items li { grid-template-columns: 1fr; }
  .sg-items .sg-thumb.small { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sg-bar i, .sg-drop { transition: none; } }

/* ================= v6.1 ================= */
.field-hint { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.overview-note { margin: 0 0 18px; font-size: 13px; }
.row-actions { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.sg-progress { width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--tint2); overflow: hidden; appearance: none; }
.sg-progress::-webkit-progress-bar { background: var(--tint2); border-radius: 99px; }
.sg-progress::-webkit-progress-value { background: var(--blue); border-radius: 99px; }
.sg-progress::-moz-progress-bar { background: var(--blue); border-radius: 99px; }
/* system health */
.sg-health { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--gray); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.sg-health-operacional { border-left-color: var(--green); }
.sg-health-atencao { border-left-color: #E0A030; }
.sg-health-erro { border-left-color: var(--red); }
.sg-health-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; margin-bottom: 8px; }
.sg-health-head strong { font-size: 17px; }
.sg-health-head span { font-size: 12px; color: var(--muted); }
.sg-health ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sg-health li { display: grid; grid-template-columns: 110px 210px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.sg-health li span { color: var(--muted); }
.sg-reason, .sg-reasons { color: var(--muted); font-size: 12px; line-height: 1.45; }
.sg-reasons { margin: 6px 0 0; padding-left: 16px; max-width: 360px; white-space: normal; }
.sg-audio { display: block; margin-top: 6px; white-space: normal; }
.sg-audio.good { color: var(--green-700); }
.sg-audio.warn { color: #8A5A12; }
.sg-versions { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.sg-versions li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.sg-versions small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tpl-thumb { aspect-ratio: 1600 / 1358; background: var(--deep); display: block; overflow: hidden; }
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-card .sg-card-foot { flex-wrap: wrap; justify-content: flex-start; gap: 0 10px; }
.tpl-choose { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tpl-kind { display: grid; gap: 6px; text-align: left; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 16px; cursor: pointer; color: var(--ink); }
.tpl-kind:hover, .tpl-kind:focus-visible { border-color: var(--blue); background: var(--tint); }
.tpl-kind strong { font-size: 16px; }
.tpl-kind small { color: var(--muted); line-height: 1.45; font-size: 13px; }
.tpl-letter { width: 36px; height: 36px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; }
.tpl-editor { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
.tpl-form { max-height: 68vh; overflow: auto; padding-right: 6px; }
.tpl-preview { position: sticky; top: 0; display: grid; gap: 10px; }
.tpl-canvas-wrap { position: relative; background: var(--tint2); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
#tpl-canvas { display: block; width: 100%; height: auto; touch-action: none; }
.tpl-ph { position: absolute; left: 12px; bottom: 12px; background: rgba(7, 29, 58, .85); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 8px; }
.tpl-warns { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; color: #8A5A12; }
.tpl-warns:empty { display: none; }
.tpl-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-sw { display: block; cursor: pointer; }
.tpl-sw input { position: absolute; opacity: 0; }
.tpl-sw span { display: inline-block; padding: 8px 12px 8px 34px; border: 2px solid var(--tint-line); border-radius: 99px; font-size: 12px; font-weight: 650; position: relative; }
.tpl-sw span::before { content: ""; position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.18); background: var(--sw); }
.tpl-sw input:checked + span { border-color: var(--blue); background: var(--tint); }
.tpl-sw input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw-azul { --sw: var(--brand); } .sw-marinho { --sw: var(--brand-dark); } .sw-verde { --sw: #00A862; } .sw-claro { --sw: var(--tint2); } .sw-grafite { --sw: #323F4B; }
.tpl-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-upload { position: relative; cursor: pointer; }
.tpl-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tpl-pick { text-align: left; background: #fff; }
.sg-pick .tpl-pick { cursor: pointer; }
@media (max-width: 1000px) { .tpl-editor { grid-template-columns: 1fr; } .tpl-form { max-height: none; } .tpl-preview { position: static; } .sg-health li { grid-template-columns: 100px minmax(0, 1fr); } .sg-health li span { grid-column: 1 / -1; } }
@media (max-width: 650px) { .tpl-choose { grid-template-columns: 1fr; } }
/* visually-hidden inputs must be anchored to their own label, or they cover other controls */
.tpl-sw, .sg-days label, .sg-drop, .sg-pick-item { position: relative; }
.sg > * { min-width: 0; }
.sg-health li span, .sg-health li b { overflow-wrap: anywhere; }
@media (max-width: 650px) { .sg-health li { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 6px 0; border-top: 1px solid var(--tint2); } .sg-health li span { grid-column: auto; } }
@media (max-width: 900px) { .sg-panels, .sg-form-grid { grid-template-columns: minmax(0, 1fr); } .sg-list li { flex-wrap: wrap; } .sg-list small { white-space: normal; } }

/* ================= identidade (logotipo + cores da marca) ================= */
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 4px 30px; flex-wrap: wrap; }
.side-logo { height: 46px; width: auto; max-width: 160px; object-fit: contain; background: #FFFFFF; border-radius: 10px; padding: 4px 8px; }
.side-product { font-size: 11px; letter-spacing: .32em; color: var(--brand-muted); font-weight: 700; }
.login-logo { height: 84px; width: auto; max-width: 260px; object-fit: contain; margin-bottom: 38px; display: block; }
.sidebar nav button.selected span { color: var(--accent); }
.eyebrow { color: var(--accent); }
.art-line span { background: var(--accent); }
.login-art { background: radial-gradient(circle at 75% 25%, var(--brand) 0, var(--brand-dark2) 45%, var(--brand-dark) 82%); }

.sw-marca { --sw: var(--accent); }

.brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.brand-card { display: grid; gap: 14px; padding: 22px; }
.brand-card h2 { margin: 0; }
.brand-logo-box { background: #fff; border: 1px solid var(--tint-line); border-radius: 14px; padding: 22px; display: grid; place-items: center; min-height: 180px; }
.brand-logo-box img { max-width: 100%; max-height: 150px; object-fit: contain; }
.brand-color { display: flex; gap: 8px; align-items: center; }
.brand-color input[type=color] { width: 52px; min-height: 42px; padding: 2px; border: 1px solid var(--tint-line); border-radius: 10px; background: #fff; cursor: pointer; }
.brand-color input:not([type=color]) { text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; }
.brand-preview { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--brand-dark); border-radius: 14px; padding: 16px; }
.bp-card { background: var(--brand-dark2); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 14px 16px; color: #fff; display: grid; gap: 4px; }
.bp-label { font-size: 11px; letter-spacing: .2em; color: var(--brand-muted); font-weight: 700; }
.bp-card > strong { font-size: 44px; line-height: 1; letter-spacing: -.03em; }
.bp-bar { background: linear-gradient(135deg, var(--accent), var(--accent-700)); border-radius: 9px; padding: 8px 12px; display: grid; }
.bp-bar small { font-size: 10px; letter-spacing: .14em; opacity: .9; }
.bp-bar b { font-size: 18px; }
.bp-swatches { display: grid; gap: 6px; }
.bp-sw { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.2); display: block; }
.sw-brand-dark { background: var(--brand-dark); } .sw-brand-dark2 { background: var(--brand-dark2); } .sw-brand { background: var(--brand); } .sw-accent { background: var(--accent); } .sw-accent-soft { background: var(--accent-soft); } .sw-tint2 { background: var(--tint2); }
@media (max-width: 900px) { .brand-grid { grid-template-columns: minmax(0, 1fr); } }
.card .sg-btn.tpl-upload, .sg-btn.tpl-upload { color: #fff; }
.card .sg-btn.ghost.tpl-upload { color: var(--brand-700); }

/* ================= multi-cliente ================= */
.side-product-logo { height: 44px; width: auto; max-width: 200px; background: #FFFFFF; border-radius: 10px; padding: 4px 8px; }
.side-clinic { display: flex; align-items: center; gap: 10px; margin: 0 4px 22px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.05); }
.side-clinic .side-logo { height: 36px; max-width: 96px; }
.side-clinic-name { font-size: 12px; font-weight: 700; color: #fff; line-height: 1.25; }
.platform-banner { margin: 0 4px 16px; padding: 10px 12px; border-radius: 12px; background: #FFF4E0; color: #6B4A12; font-size: 12px; display: grid; gap: 6px; }
.platform-banner b { letter-spacing: .1em; text-transform: uppercase; font-size: 10px; }
.platform-only #nav > :not([data-platform]) { display: none !important; }
.platform-only .side-section.nav-group { display: none; }
.login-card .sg-form, .login-card form label[hidden] { }

/* v6.2 - support mode bar and audit */
#support-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 24px; background: #7A3E00; color: #FFF4E0; font-size: 13px; line-height: 1.35; border-bottom: 3px solid #F5A524; }
#support-bar[hidden] { display: none; }
#support-bar .sb-tag { background: #F5A524; color: #3B1D00; font-weight: 800; letter-spacing: .08em; font-size: 11px; padding: 3px 9px; border-radius: 999px; }
#support-bar .sb-time { opacity: .85; margin-left: auto; font-size: 12px; }
#support-bar .mini-button { background: #FFF4E0; color: #5B2E00; border-color: transparent; font-weight: 700; }
.sg-support-row td { background: #FFF7E8; }
.sg-pill.sg-warn { background: #FCE7BE; color: #6B4A12; }
.sg-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }

/* v6.2 - narrow screens (360 px): the top bar wraps instead of pushing the page sideways */
@media (max-width: 650px) {
  .topbar { height: auto; min-height: 64px; padding: 10px 16px; flex-wrap: wrap; gap: 6px 12px; }
  .top-actions { flex-wrap: wrap; gap: 6px 12px; min-width: 0; }
  .user-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #support-bar { padding: 10px 16px; }
  #support-bar .sb-time { margin-left: 0; }
}
.pf-scroll { max-height: 60vh; overflow: auto; }

/* ================= v6.2.1 — Central de Campanhas ================= */
.sidebar nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.sidebar { overflow: hidden; }
.sg-play { left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: 44px; height: 44px; font-size: 15px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.sg-dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(7, 18, 30, .82); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sg-chips { display: inline-flex; gap: 6px; align-self: end; flex-wrap: wrap; }
.sg-chip { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 650; }
.sg-chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.sg-hidden-select { display: none !important; }
.sg-hint { display: inline-block; font-size: 11.5px; color: var(--muted); }

.sg-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; }
button.metric.sg-kpi { text-align: left; font: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
button.metric.sg-kpi:hover { border-color: var(--blue); transform: translateY(-1px); }
.sg-kpi.amber strong { color: var(--amber); } .sg-kpi.red strong { color: var(--red); }
.sg-kpi strong { font-size: 32px; margin: 10px 0 2px; }
.sg-card-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-bottom: 12px; }
.sg-card-title h2 { margin: 0; } .sg-card-title small { color: var(--muted); font-size: 12px; }
.sg-now-card { margin-bottom: 18px; }
.sg-now td small { display: block; margin-top: 4px; white-space: normal; }
.sg-now .warn, small.warn, b.warn { color: var(--amber); }
@media (max-width: 1200px) { .sg-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 650px) { .sg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sg-kpi strong { font-size: 26px; } }

.cc-steps { display: flex; flex-wrap: wrap; gap: 8px 28px; list-style: none; padding: 0; margin: -8px 0 22px; color: var(--muted); font-size: 13px; }
.cc-steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sky); color: var(--navy); font-size: 12px; margin-right: 6px; }
.cc-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.cc-option { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.cc-option h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.01em; }
.cc-option p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.cc-letter { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 800; font-size: 17px; }
.cc-option .sg-btn { align-self: flex-start; }
.cc-file { position: relative; cursor: pointer; }
.cc-file input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.cc-progress { display: grid; gap: 4px; } .cc-progress small { font-size: 12px; color: var(--muted); } .cc-progress.bad small { color: var(--red); }

.cc-conflicts { border-color: #F2D49B; margin-bottom: 18px; }
.cc-grid { display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr)); gap: 4px; min-width: 640px; }
.card:has(> .cc-grid) { overflow-x: auto; }
.cc-hours { position: relative; margin-top: 30px; height: 420px; }
.cc-hours span { position: absolute; left: 0; font-size: 11px; color: var(--muted); transform: translateY(-50%); }
.cc-day-name { height: 26px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.cc-day.today .cc-day-name { color: var(--blue); }
.cc-day-body { position: relative; height: 420px; border-radius: 10px; background: repeating-linear-gradient(to bottom, var(--canvas) 0, var(--canvas) 52px, #fff 52px, #fff 105px); border: 1px solid var(--line); overflow: hidden; }
.cc-day.today .cc-day-body { border-color: var(--blue); }
.cc-block { position: absolute; border: 0; border-left: 4px solid var(--green-700); border-radius: 6px; background: #E3F5EC; color: var(--ink); padding: 4px 6px; text-align: left; overflow: hidden; font: inherit; font-size: 11px; line-height: 1.2; cursor: pointer; }
.cc-block b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-block small { color: var(--muted); }
.cc-block.st-agendada { background: #E6F0FB; border-left-color: var(--blue); }
.cc-block.st-pausada { background: #FBF1DF; border-left-color: var(--amber); opacity: .8; }
.cc-block.excl { box-shadow: inset 0 0 0 2px #7C3AED; }
.cc-block:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 2; }
.cc-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; }
.cc-key { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 6px; font-size: 11px; background: #E3F5EC; }
.cc-key.st-agendada { background: #E6F0FB; } .cc-key.st-pausada { background: #FBF1DF; } .cc-key.excl { background: #fff; box-shadow: inset 0 0 0 2px #7C3AED; }

.tpl-tv .tpl-tv-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.tpl-tv-controls { display: grid; gap: 12px; font-size: 13px; }
.tpl-tv-controls label { display: grid; gap: 6px; font-weight: 650; }
.tpl-tv-controls small { color: var(--muted); line-height: 1.45; }
.tpl-tv #tpl-crop { background: var(--canvas); border-radius: 10px; padding: 10px 12px; line-height: 1.45; color: var(--ink); }
.sg-dialog.wide.tpl-tv { width: min(1280px, 96vw); }
@media (max-width: 900px) { .tpl-tv .tpl-tv-body { grid-template-columns: minmax(0, 1fr); } }
.cc-gantt { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(7, minmax(56px, 1fr)); gap: 4px; min-width: 720px; align-items: stretch; }
.card:has(> .cc-gantt) { overflow-x: auto; }
.cc-gh { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cc-gh small { display: block; font-weight: 500; font-size: 10px; opacity: .8; }
.cc-gh.today { color: var(--blue); }
.cc-gh.cc-gname { text-align: left; }
.cc-row-name { text-align: left; border: 0; background: none; padding: 6px 8px 6px 0; font: inherit; cursor: pointer; color: var(--ink); min-width: 0; }
.cc-row-name b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-row-name small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-row-name:hover b { color: var(--blue); text-decoration: underline; }
.cc-cell { position: relative; min-height: 38px; border-radius: 8px; background: var(--canvas); border: 1px solid var(--line); }
.cc-cell.off { background: repeating-linear-gradient(135deg, #fff 0 6px, var(--canvas) 6px 12px); }
.cc-cell.today { border-color: var(--blue); }
.cc-bar { position: absolute; top: 9px; bottom: 9px; border-radius: 5px; background: #2FA36B; }
.cc-bar.st-agendada { background: var(--blue); } .cc-bar.st-pausada { background: #D9A441; opacity: .75; }
.cc-bar.excl { box-shadow: 0 0 0 2px #7C3AED; }
.cc-cell .cc-now { position: absolute; top: 2px; bottom: 2px; width: 2px; height: auto; right: auto; background: var(--red); z-index: 2; }
.sidebar nav button, .sidebar nav a { min-height: 40px; padding-top: 9px; padding-bottom: 9px; }
.tpl-tv-controls select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-weight: 500; }
/* MK Saúde (somente leitura) */
.mk-card { margin-top: 18px; }
.mk-card h2 small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.mk-card .sg-card-title small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.mk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mk-test { min-height: 20px; margin: 6px 0 0; font-size: 13px; }
@media (max-width: 900px) { .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .mk-grid { grid-template-columns: minmax(0, 1fr); } }
/* logotipo oficial Cavalcante Tech (horizontal, ~5,5:1) */
.login-logo { width: min(380px, 100%); max-width: none; height: auto; margin-bottom: 34px; }
.side-product-logo { width: 196px; max-width: 100%; height: auto; padding: 8px 10px; box-sizing: border-box; }
