/* Portal de Vídeos — estilo único das três telas, com tema claro e escuro.
   O tema é escolhido pelo atributo data-tema no <html> (ver tema.js). */
:root {
  --fundo: #f3f4f7; --lateral: #ffffff; --painel: #ffffff; --interno: #f3f4f7; --borda: #dde0e7;
  --texto: #14171c; --suave: #4a525e; --destaque: #4b3df5; --sobre-destaque: #ffffff; --ativo: #ecebfe;
  --ok-f: #ddf1e7; --ok-t: #14603f; --erro-f: #fbe3de; --erro-t: #a8321f; --info-f: #e4e4fd; --info-t: #2a27b8;
  --neutro-f: #eceef2; --neutro-t: #4a525e; --sombra: rgba(20, 23, 28, 0.14); --video: #14171c;
  color-scheme: light;
}
:root[data-tema="escuro"] {
  --fundo: #16181d; --lateral: #1b1e24; --painel: #22262e; --interno: #2c313b; --borda: #3b414d;
  --texto: #f7f8fa; --suave: #c2c8d3; --destaque: #9d97ff; --sobre-destaque: #14171c; --ativo: #343949;
  --ok-f: #17402e; --ok-t: #8fe5b8; --erro-f: #4a211b; --erro-t: #ffb3a6; --info-f: #2c2b63; --info-t: #c9c6ff;
  --neutro-f: #2c313b; --neutro-t: #c2c8d3; --sombra: rgba(0, 0, 0, 0.5); --video: #0e1013;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fundo); color: var(--texto); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.15rem; letter-spacing: -0.01em; font-weight: 600; }
a { color: var(--texto); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--destaque); outline-offset: 2px; }
.oculto { display: none !important; }
.so-leitor { position: absolute; left: -9999px; }

/* ---- Estrutura: menu lateral + conteúdo ---- */
.app { display: flex; min-height: 100vh; }
.lateral { flex: none; width: 244px; height: 100vh; position: sticky; top: 0; padding: 22px 16px; background: var(--lateral); border-right: 1px solid var(--borda); display: flex; flex-direction: column; gap: 28px; }
.marca { padding: 4px 8px; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.marca img { flex: none; }
.marca > span { display: grid; }
.logo-entrada { display: block; }
.marca small { font-size: 0.8rem; font-weight: 400; letter-spacing: 0; color: var(--suave); }
.menu { display: flex; flex-direction: column; gap: 4px; }
.item { min-height: 46px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--suave); font: inherit; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 14px; text-align: left; }
.item:hover { color: var(--texto); background: var(--interno); }
.item[aria-current="page"] { background: var(--ativo); color: var(--texto); }
.item span:first-of-type { flex: 1; }
.item .conta-n { font-size: 0.8rem; }
.item .conta-n.urgente { white-space: nowrap; background: var(--erro-f); color: var(--erro-t); border: 1px solid var(--erro-t); border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.pilula.vazia { background: var(--erro-f); color: var(--erro-t); border-color: var(--erro-t); font-weight: 600; }
.conteudo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 32px; }
.pagina { width: 100%; max-width: 1120px; margin: 0 auto; padding: 12px 32px 96px; display: grid; gap: 20px; align-content: start; }
.cabeca { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---- Peças ---- */
.painel { background: var(--painel); border: 1px solid var(--borda); border-radius: 24px; padding: 24px; display: grid; gap: 18px; min-width: 0; }
.bloco { background: var(--interno); border-radius: 16px; padding: 18px; display: grid; gap: 10px; align-content: start; }
.pilula { min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--painel); border: 1px solid var(--borda); display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; white-space: nowrap; }
.dica { color: var(--suave); font-size: 0.88rem; margin: 0; }
.msg { margin: 0; font-size: 0.93rem; min-height: 1.4em; }
.msg:empty { display: none; }
.msg.erro { color: var(--erro-t); } .msg.ok { color: var(--ok-t); }
.aviso { margin: 0; background: var(--info-f); color: var(--info-t); border-radius: 16px; padding: 14px 18px; font-size: 0.93rem; }
.alerta { background: var(--erro-f); color: var(--erro-t); border: 1px solid var(--erro-t); border-radius: 20px; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.alerta div { flex: 1; min-width: 240px; display: grid; gap: 4px; }
.alerta strong { font-size: 1.1rem; }
.grande { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.enorme { font-size: clamp(2.6rem, 5.4vw, 4.6rem); font-weight: 700; letter-spacing: -0.04em; line-height: 0.95; }
.enorme small { font-size: 0.36em; font-weight: 600; letter-spacing: -0.02em; color: var(--suave); }
.linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.entre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cresce { flex: 1; min-width: 0; }
.rodape-form { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; border-top: 1px solid var(--borda); padding-top: 20px; }

/* ---- Botões ---- */
.bt { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--borda); background: transparent; color: var(--texto); font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; }
.bt:hover { background: var(--interno); }
.bt:disabled { opacity: 0.45; cursor: not-allowed; }
.bt.principal { background: var(--destaque); border-color: var(--destaque); color: var(--sobre-destaque); }
.bt.principal:hover { filter: brightness(1.08); }
.bt.forte { background: var(--texto); border-color: var(--texto); color: var(--fundo); }
.bt.perigo { border-color: var(--erro-t); color: var(--erro-t); }
.bt.alto { min-height: 54px; padding: 0 34px; font-size: 1.05rem; }
.bt.redondo { width: 44px; padding: 0; }
.bt.marcado { background: var(--destaque); border-color: var(--destaque); color: var(--sobre-destaque); }
.alerta .bt { background: var(--erro-t); border-color: var(--erro-t); color: var(--erro-f); }
.chip[aria-pressed="true"] { background: var(--texto); border-color: var(--texto); color: var(--fundo); }
details.conta { position: relative; }
details.conta summary { list-style: none; background: var(--painel); font-weight: 500; }
details.conta summary::-webkit-details-marker { display: none; }
.suspenso { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; min-width: 190px; padding: 8px; background: var(--painel); border: 1px solid var(--borda); border-radius: 16px; box-shadow: 0 12px 40px var(--sombra); display: grid; gap: 2px; }
.suspenso button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--texto); font: inherit; text-align: left; cursor: pointer; }
.suspenso button:hover { background: var(--interno); }
#btTema { background: var(--painel); font-weight: 500; }

/* ---- Campos ---- */
label, .rotulo { font-weight: 600; font-size: 0.95rem; }
input, textarea, select { width: 100%; padding: 12px 16px; border: 1px solid var(--borda); border-radius: 14px; background: var(--interno); color: var(--texto); font: inherit; }
input::placeholder, textarea::placeholder { color: var(--suave); opacity: 1; }
textarea { min-height: 150px; padding: 18px; border-radius: 16px; resize: vertical; font-size: 1.05rem; }
input[type="search"] { border-radius: 999px; min-height: 46px; padding: 0 18px; }
input[type="range"] { padding: 0; border: 0; background: transparent; height: 44px; accent-color: var(--destaque); }
.painel .bloco input:not([type="range"]), dialog input { background: var(--painel); }
.campo { display: grid; gap: 8px; }
.trio { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.pontas { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--suave); }
.formato { position: relative; }
.formato input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.formato span { min-height: 44px; padding: 0 14px; border: 1px solid var(--borda); border-radius: 12px; display: flex; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; }
.formato i { flex: none; border: 2px solid currentColor; border-radius: 4px; }
.formato i.v { width: 12px; height: 20px; } .formato i.h { width: 22px; height: 13px; }
.formato input:checked + span { background: var(--texto); border-color: var(--texto); color: var(--fundo); }
.formato input:focus-visible + span { outline: 3px solid var(--destaque); outline-offset: 2px; }
.refs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ref { position: relative; width: 58px; height: 58px; }
.ref img { width: 58px; height: 58px; object-fit: cover; border-radius: 12px; border: 1px solid var(--borda); display: block; }
.ref button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 999px; border: 1px solid var(--borda); background: var(--painel); color: var(--texto); font: 600 14px/1 system-ui, sans-serif; cursor: pointer; }
.mais { width: 58px; height: 58px; border-radius: 12px; border: 1.5px dashed var(--suave); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 400; color: var(--texto); cursor: pointer; }
.mais input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mais:focus-within { outline: 3px solid var(--destaque); outline-offset: 2px; }

/* ---- Andamento e orçamento ---- */
.trilho { height: 10px; border-radius: 999px; background: var(--interno); overflow: hidden; }
.trilho div { height: 100%; border-radius: 999px; background: var(--destaque); }
.trilho.andando div { width: 40%; animation: vai 1.6s ease-in-out infinite alternate; }
@keyframes vai { from { transform: translateX(-60%); } to { transform: translateX(210%); } }
@media (prefers-reduced-motion: reduce) { .trilho.andando div { animation: none; width: 100%; opacity: 0.5; } }
.fatos { display: flex; gap: 36px; flex-wrap: wrap; }
.fatos div { display: grid; gap: 2px; } .fatos span { font-size: 0.88rem; color: var(--suave); } .fatos b { font-size: 1.15rem; font-weight: 600; }

/* ---- Vídeos do cliente ---- */
.videos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.video { background: var(--fundo); border: 1.5px solid var(--borda); border-radius: 18px; padding: 8px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.video.marcado { border-color: var(--destaque); }
.video video, .video .espera { width: 100%; height: 250px; border-radius: 12px; background: var(--video); object-fit: contain; display: block; }
.video .espera { display: grid; place-items: center; align-content: center; gap: 14px; color: #d5dae3; text-align: center; padding: 18px; font-size: 0.9rem; }
.video .info { padding: 0 8px; display: grid; gap: 2px; }
.video .texto { font-size: 0.93rem; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video .data { font-size: 0.8rem; color: var(--suave); }
.video .acoes { display: flex; gap: 6px; padding: 0 4px 4px; margin-top: auto; }
.video .acoes .cresce { font-size: 0.88rem; padding: 0 10px; }
.girando { width: 30px; height: 30px; border: 3px solid #4a515e; border-top-color: #ffffff; border-radius: 50%; animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .girando { animation: none; } }
.vazio { color: var(--suave); margin: 0; }
.unir { position: sticky; bottom: 20px; z-index: 3; justify-self: center; width: 100%; max-width: 760px; background: var(--painel); border: 1px solid var(--borda); border-radius: 28px; padding: 14px 14px 14px 24px; box-shadow: 0 12px 40px var(--sombra); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.unir .cresce { display: grid; gap: 2px; min-width: 200px; }

/* ---- Administração ---- */
.duas { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); align-items: start; }
.clientes-area { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.clientes-area > .lista { flex: 999 1 420px; padding: 12px; gap: 6px; }
.clientes-area > .ficha { flex: 1 1 360px; max-width: 480px; }
.cliente { width: 100%; min-height: 74px; padding: 12px 16px; border: 1.5px solid transparent; border-radius: 16px; background: transparent; color: var(--texto); font: inherit; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; text-align: left; }
.cliente:hover { background: var(--interno); }
.cliente[aria-pressed="true"] { background: var(--ativo); border-color: var(--destaque); }
.cliente span { display: grid; gap: 3px; min-width: 0; } .cliente span:last-child { justify-items: end; }
.cliente b { font-weight: 600; } .cliente small { font-size: 0.88rem; color: var(--suave); }
.etiqueta { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; background: var(--ok-f); color: var(--ok-t); }
.etiqueta.erro { background: var(--erro-f); color: var(--erro-t); }
.etiqueta.info { background: var(--info-f); color: var(--info-t); }
.etiqueta.neutro { background: var(--neutro-f); color: var(--neutro-t); }
.pendencia { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--borda); }
.pendencia div { flex: 1; min-width: 180px; display: grid; gap: 2px; }
.pendencia.urgente b { color: var(--erro-t); }
.pendencia b { font-weight: 600; font-size: 0.95rem; } .pendencia small { font-size: 0.88rem; color: var(--suave); }
.painel > h2 + .pendencia, .lista-simples > .pendencia:first-child { border-top: 1px solid var(--borda); }
.lista-simples { display: grid; }
.rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 15px 8px; vertical-align: middle; }
tbody tr { border-top: 1px solid var(--borda); }
th { font-size: 0.88rem; font-weight: 500; color: var(--suave); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.forte { font-weight: 600; white-space: nowrap; } td.apagado { color: var(--suave); min-width: 220px; } td.mais-t { color: var(--ok-t); }
td .linha { justify-content: flex-end; flex-wrap: nowrap; }
.grade { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ---- Janelas ---- */
dialog { border: 1px solid var(--borda); border-radius: 24px; padding: 26px; width: min(92vw, 420px); background: var(--painel); color: var(--texto); box-shadow: 0 24px 80px var(--sombra); }
dialog::backdrop { background: rgba(10, 12, 15, 0.6); }
dialog form, dialog .corpo { display: grid; gap: 14px; }
dialog.largo { width: min(94vw, 560px); }
dialog video { width: 100%; max-height: 62vh; background: var(--video); border-radius: 12px; display: block; }

/* ---- Login ---- */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.entrada .painel { width: 100%; max-width: 400px; padding: 32px; }
.entrada .bt { width: 100%; margin-top: 6px; }
.entrada .tema-canto { position: fixed; top: 16px; right: 16px; width: auto; margin: 0; }

/* ---- Telas estreitas: o menu sobe para o topo ---- */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .lateral { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--borda); }
  .menu { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .item { padding: 0 14px; }
  .barra .dica.cresce { flex-basis: 100%; }
  .linha input[type="search"] { flex-basis: 100%; }
  .item span:first-of-type { flex: none; }
  .barra { padding: 12px 16px; justify-content: flex-start; }
  .pagina { padding: 8px 16px 96px; }
  h1 { font-size: 1.7rem; }
  .painel { padding: 18px; border-radius: 20px; }
}
