/* ══════════════════════════════════════════════════════════════════
   LEVANTAMENTO 3D — estilos das duas telas (escritorio e cliente).
   Herda as variaveis do style.css; a pagina do cliente carrega so
   este arquivo, entao os poucos tokens usados vem com valor de
   reserva no :root abaixo.
   ══════════════════════════════════════════════════════════════════ */

/* O atributo hidden e a unica forma de esconder usada nas duas telas
   (JS faz elemento.hidden = true). Como quase todo bloco daqui define
   display:flex por classe, o hidden do navegador — que vem da folha do
   proprio navegador — perdia a disputa e o elemento continuava na tela:
   o aviso "Carregando modelo..." ficava por cima do modelo ja carregado,
   como se o carregamento nunca terminasse. Esta regra fecha isso de uma
   vez, para todos os blocos das duas telas. */
[hidden] { display:none !important; }

.s3-layout { display:grid; grid-template-columns:340px 1fr; gap:20px; min-height:calc(100vh - 140px); }
@media (max-width: 1000px) { .s3-layout { grid-template-columns:1fr; } }

/* ── Lista ───────────────────────────────────────────────────────── */
.s3-list-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); display:flex; flex-direction:column; overflow:hidden; max-height:calc(100vh - 140px); }
.s3-list-header { padding:14px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.s3-list-header h3 { font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-dark); }
.s3-count { font-size:11px; color:var(--text-gray); font-weight:600; }
.s3-filtros { padding:10px 14px; border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:8px; }
.s3-list-body { flex:1; overflow-y:auto; padding:8px; }

.s3-input, .s3-select { width:100%; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; font-family:inherit; font-size:13px; color:var(--text-dark); background:var(--white); }
.s3-input:focus, .s3-select:focus { outline:none; border-color:var(--accent); }
textarea.s3-input { resize:vertical; }

/* ── Combo digitavel (projeto) ────────────────────────────────────── */
.s3-combo { position:relative; }
.s3-combo-campo { padding-right:28px; background-repeat:no-repeat; background-position:right 9px center; background-size:12px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.s3-combo-lista { position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:60; padding:4px; max-height:264px; overflow-y:auto;
  background:var(--white); border:1px solid var(--border); border-radius:var(--radius-sm); box-shadow:0 10px 26px rgba(0,0,0,.13); }
.s3-combo-item { padding:7px 9px; border-radius:6px; font-size:12.5px; color:var(--text-dark); cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.s3-combo-item.marcado { background:var(--bg-light); }
.s3-combo-item.atual { color:#0f4c3a; font-weight:600; }
.s3-combo-nada { padding:8px 9px; font-size:12px; color:var(--text-gray); }

.s3-item { display:flex; gap:10px; padding:9px 10px; border-radius:var(--radius-sm); cursor:pointer; margin-bottom:4px; border:1px solid transparent; transition:background .12s, border-color .12s; }
.s3-item:hover { background:var(--bg-light); }
.s3-item.ativo { background:var(--bg-green); border-color:var(--accent); }
.s3-item-thumb { width:52px; height:52px; flex:none; border-radius:var(--radius-sm); background:var(--bg-light); display:flex; align-items:center; justify-content:center; color:var(--text-gray); overflow:hidden; }
.s3-item-thumb img { width:100%; height:100%; object-fit:cover; }
.s3-item-thumb svg { width:20px; height:20px; }
.s3-item-txt { min-width:0; flex:1; }
.s3-item-txt h4 { font-size:13px; font-weight:600; color:var(--text-dark); margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.s3-item-sub { font-size:11px; color:var(--text-gray); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.s3-item-meta { display:flex; gap:5px; align-items:center; margin-top:4px; flex-wrap:wrap; }

.s3-fase { font-size:10px; font-weight:700; padding:1px 7px; border-radius:50px; text-transform:uppercase; letter-spacing:.03em; }
.s3-fase.levantamento { background:#e0e7ff; color:#3730a3; }
.s3-fase.obra         { background:#fef3c7; color:#92400e; }
.s3-fase.entrega      { background:#dcfce7; color:#166534; }
.s3-chip-share { font-size:10px; font-weight:700; padding:1px 7px; border-radius:50px; background:var(--bg-green); color:#0f4c3a; display:inline-flex; align-items:center; gap:3px; }

.s3-grupo { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-gray); padding:12px 10px 5px; }

/* ── Detalhe ─────────────────────────────────────────────────────── */
.s3-detail-card { background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:20px; overflow-y:auto; max-height:calc(100vh - 140px); }
.s3-detail-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.s3-detail-head h2 { font-size:18px; font-weight:700; color:var(--text-dark); margin-bottom:4px; }
.s3-detail-meta { font-size:12px; color:var(--text-gray); display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.s3-detail-acoes { display:flex; gap:4px; flex:none; }

.s3-vazio { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; min-height:400px; color:var(--text-gray); text-align:center; }
.s3-vazio-icon { width:76px; height:76px; background:var(--bg-green); border-radius:50%; display:flex; align-items:center; justify-content:center; margin-bottom:16px; color:var(--accent); }
.s3-vazio-icon svg { width:32px; height:32px; }
.s3-vazio h3 { font-size:16px; font-weight:700; color:var(--text-dark); margin-bottom:6px; }
.s3-vazio p { font-size:13px; max-width:400px; line-height:1.6; }

/* ── Palco 3D ────────────────────────────────────────────────────── */
.s3-palco { position:relative; width:100%; height:min(58vh, 540px); min-height:320px; border-radius:var(--radius); overflow:hidden; background:var(--bg-light); border:1px solid var(--border); }
.s3-palco canvas { width:100%; height:100%; }

.sv-overlay { position:absolute; inset:0; pointer-events:none; }
.sv-cota { position:absolute; transform:translate(-50%, -50%); background:#ef4444; color:#fff; font-size:11px; font-weight:700; padding:2px 7px; border-radius:50px; white-space:nowrap; box-shadow:0 1px 4px rgba(0,0,0,.25); }
/* A cota em aberto: mesma etiqueta, um pouco apagada, pra nao se
   confundir com as que ja foram cravadas. */
.sv-cota-previa { opacity:.92; font-weight:800; }

.s3-ferramentas { position:absolute; top:12px; left:12px; display:flex; align-items:center; gap:4px; background:rgba(255,255,255,.94); border:1px solid var(--border); border-radius:50px; padding:4px; box-shadow:0 2px 8px rgba(0,0,0,.07); }
.s3-fer { width:32px; height:32px; border:none; background:none; border-radius:50%; cursor:pointer; color:var(--text-gray); display:flex; align-items:center; justify-content:center; }
.s3-fer:hover { background:var(--bg-light); color:var(--text-dark); }
.s3-fer.ativo { background:#0f4c3a; color:#fff; }
.s3-fer svg { width:16px; height:16px; }
.s3-fer-sep { width:1px; height:18px; background:var(--border); margin:0 2px; }


.s3-dica { position:absolute; bottom:12px; left:50%; transform:translateX(-50%); background:rgba(17,24,39,.88); color:#fff; font-size:11.5px; padding:5px 12px; border-radius:50px; }
.s3-palco-vazio, .s3-carregando { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:var(--text-gray); font-size:13px; text-align:center; background:var(--bg-light); }
.s3-palco-vazio svg { width:34px; height:34px; opacity:.5; }
.s3-palco-vazio span { font-size:11.5px; opacity:.75; }
.s3-spinner { width:26px; height:26px; border:3px solid var(--border); border-top-color:var(--accent-dark, #5fa882); border-radius:50%; animation:s3gira .8s linear infinite; }
@keyframes s3gira { to { transform:rotate(360deg); } }

/* ── Abas ────────────────────────────────────────────────────────── */
.s3-abas { display:flex; gap:2px; border-bottom:1px solid var(--border); margin:18px 0 0; overflow-x:auto; }
.s3-aba { background:none; border:none; border-bottom:2px solid transparent; padding:9px 14px; font-family:inherit; font-size:12.5px; font-weight:600; color:var(--text-gray); cursor:pointer; display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.s3-aba svg { width:14px; height:14px; }
.s3-aba:hover { color:var(--text-dark); }
.s3-aba.ativa { color:#0f4c3a; border-bottom-color:#0f4c3a; }
.s3-painel { display:none; padding:16px 2px 4px; }
.s3-painel.ativo { display:block; }
.s3-painel-head { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.s3-ajuda { font-size:12.5px; color:var(--text-gray); line-height:1.6; margin:0; }
small.s3-ajuda { display:block; margin-top:4px; }

/* ── Cotas ───────────────────────────────────────────────────────── */
.s3-cotas { margin-top:12px; display:flex; flex-direction:column; gap:6px; }
.s3-cota-item { display:flex; align-items:center; justify-content:space-between; gap:10px; background:var(--bg-light); border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 12px; }
.s3-cota-item strong { font-size:14px; color:var(--text-dark); font-variant-numeric:tabular-nums; }
.s3-cota-item small { font-size:11px; color:var(--text-gray); }
.s3-cota-x { background:none; border:none; color:var(--text-gray); cursor:pointer; font-size:17px; line-height:1; padding:0 3px; }
.s3-cota-x:hover { color:#dc2626; }
.s3-nada { font-size:12.5px; color:var(--text-gray); padding:14px 0; }

/* ── Corte / DXF ─────────────────────────────────────────────────── */
.s3-corte-linha { display:flex; align-items:center; gap:12px; margin-top:12px; flex-wrap:wrap; }
.s3-corte-linha > label { font-size:12px; font-weight:600; color:var(--text-dark); min-width:110px; }
.s3-corte-linha input[type=range] { flex:1; min-width:180px; accent-color:#0f4c3a; }
.s3-corte-linha output { font-size:14px; font-weight:700; color:#0f4c3a; font-variant-numeric:tabular-nums; min-width:74px; text-align:right; }
.s3-check { display:inline-flex; align-items:center; gap:7px; font-size:12.5px; color:var(--text-dark); cursor:pointer; }
.s3-check input { accent-color:#0f4c3a; width:15px; height:15px; }
.s3-corte-status { margin-top:12px; font-size:12.5px; color:var(--text-gray); background:var(--bg-light); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; }

/* ── Arquivos ────────────────────────────────────────────────────── */
.s3-arquivos { display:flex; flex-direction:column; gap:8px; }
.s3-arq { display:flex; align-items:center; gap:11px; background:var(--bg-light); border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; }
.s3-arq-icone { width:34px; height:34px; flex:none; border-radius:var(--radius-sm); background:var(--white); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; color:var(--text-gray); }
.s3-arq-icone svg { width:16px; height:16px; }
.s3-arq-txt { flex:1; min-width:0; }
.s3-arq-txt strong { display:block; font-size:12.5px; color:var(--text-dark); }
.s3-arq-txt small { font-size:11px; color:var(--text-gray); }
.s3-arq-falta { opacity:.6; }

/* ── Compartilhar ────────────────────────────────────────────────── */
.s3-switch { font-weight:600; margin-bottom:10px; }
.s3-link-box { display:flex; gap:8px; align-items:center; margin-top:14px; flex-wrap:wrap; }
.s3-link-box input { flex:1; min-width:220px; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; font-size:12px; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; color:var(--text-dark); background:var(--bg-light); }

/* ── Modais ──────────────────────────────────────────────────────── */
.s3-modal { position:fixed; inset:0; background:rgba(17,24,39,.5); display:flex; align-items:center; justify-content:center; padding:16px; z-index:200; }
.s3-modal-caixa { background:var(--white); border-radius:var(--radius); width:100%; max-width:640px; max-height:92vh; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 20px 50px rgba(0,0,0,.22); }
.s3-modal-head { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.s3-modal-head h3 { font-size:15px; font-weight:700; color:var(--text-dark); }
.s3-modal-x { background:none; border:none; font-size:24px; line-height:1; color:var(--text-gray); cursor:pointer; padding:0 4px; }
.s3-modal-corpo { padding:20px; overflow-y:auto; flex:1; }
.s3-modal-pe { padding:14px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }

.s3-form-linha { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width:560px) { .s3-form-linha { grid-template-columns:1fr; } }
.s3-campo { margin-bottom:14px; }
.s3-campo > label { display:block; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-gray); margin-bottom:5px; }

.s3-uploads { display:flex; flex-direction:column; gap:10px; margin-top:6px; padding-top:16px; border-top:1px solid var(--border); }
.s3-upload { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; background:var(--bg-light); border:1px solid var(--border); border-radius:var(--radius-sm); padding:11px 13px; }
.s3-upload-info strong { display:block; font-size:12.5px; color:var(--text-dark); margin-bottom:2px; }
.s3-upload-info small { font-size:11px; color:var(--text-gray); }
.s3-upload input[type=file] { font-size:11.5px; max-width:100%; }
.s3-tag-req, .s3-tag-opt { font-size:9.5px; font-weight:700; padding:1px 6px; border-radius:50px; text-transform:uppercase; letter-spacing:.03em; margin-left:4px; vertical-align:middle; }
.s3-tag-req { background:#0f4c3a; color:#fff; }
.s3-tag-opt { background:var(--border); color:var(--text-gray); }

.s3-progresso { margin-top:16px; }
.s3-progresso-barra { height:6px; background:var(--border); border-radius:50px; overflow:hidden; }
.s3-progresso-barra span { display:block; height:100%; width:0; background:#0f4c3a; transition:width .2s; }
.s3-progresso small { display:block; margin-top:6px; font-size:11.5px; color:var(--text-gray); }

.s3-ajuda-texto p  { font-size:13px; line-height:1.7; color:var(--text-dark); margin-bottom:12px; }
.s3-ajuda-texto ol { padding-left:20px; margin-bottom:12px; }
.s3-ajuda-texto li { font-size:13px; line-height:1.7; color:var(--text-dark); margin-bottom:8px; }
.s3-ajuda-nota { background:var(--bg-green); border-radius:var(--radius-sm); padding:11px 13px; font-size:12.5px !important; color:#0f4c3a !important; }

/* ── Aviso flutuante ─────────────────────────────────────────────── */
.s3-toast { position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:#111827; color:#fff; font-size:13px; padding:10px 18px; border-radius:50px; z-index:300; box-shadow:0 6px 20px rgba(0,0,0,.25); }
.s3-toast.erro { background:#991b1b; }
