/* Visual comum das telas de pedidos de arte (pedidos.html e designer.html).
   Cada tela define --cor e --cor-escura no :root. */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f5f5f5; color: #333; }
.hidden { display: none !important; }
.header { background: linear-gradient(135deg, var(--cor), var(--cor-escura)); color: white; padding: 20px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.2); position: relative; }
.header h1 { font-size: 24px; margin-bottom: 5px; }
.header p { opacity: .9; }
.user-area { position: absolute; right: 20px; top: 18px; display: flex; align-items: center; gap: 10px; }
.user-chip { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); padding: 7px 12px; border-radius: 18px; font-size: 13px; }
.logout-btn { background: white; color: var(--cor-texto, var(--cor-escura)); border: 0; padding: 7px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.container { max-width: 1200px; margin: 20px auto; padding: 0 20px 90px; }
.barra { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.barra input, .barra select { padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; font: inherit; font-size: 14px; background: white; }
.barra input { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 10px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px; }
.tab { padding: 11px 20px; background: white; border: 0; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; box-shadow: 0 2px 5px rgba(0,0,0,.1); white-space: nowrap; font-family: inherit; }
.tab.active { background: var(--cor); color: white; }
.badge { background: #ef5350; color: white; padding: 2px 8px; border-radius: 12px; font-size: 12px; margin-left: 6px; }
.tab.active .badge { background: white; color: var(--cor-texto, var(--cor-escura)); }
.lista { display: grid; gap: 15px; }
.card { background: white; border-radius: 12px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(0,0,0,.08); border-left: 5px solid var(--cor); }
.card.estado-pronto { border-left-color: #43A047; }
.card.estado-aberto { border-left-color: #FB8C00; }
.card.estado-entregue, .card.estado-cancelado { border-left-color: #bdbdbd; opacity: .85; }
.card-topo { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.card-titulo { font-size: 18px; font-weight: 700; color: var(--cor-texto, var(--cor-escura)); word-break: break-word; }
.numero { color: #888; font-weight: 600; font-size: 15px; margin-right: 4px; }
.card-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.chip { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: #eee; color: #444; }
.chip.designer { background: color-mix(in srgb, var(--cor, #607D8B) 15%, var(--mistura, white)); color: #333; border-left: 4px solid var(--cor, #607D8B); }
.tipo-arte { background: #ede7f6; color: #4527a0; }
.tipo-repeticao { background: #e3f2fd; color: #1565c0; }
.tipo-folha { background: #fff3e0; color: #e65100; }
.tipo-alteracao { background: #fce4ec; color: #ad1457; }
.prazo { color: #666; font-weight: 600; }
.prazo.atrasado { color: #c62828; }
.prazo.hoje { color: #e65100; }
.status { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.status-aberto { background: #fff3e0; color: #e65100; }
.status-em_producao { background: #e3f2fd; color: #1565c0; }
.status-pronto { background: #e8f5e9; color: #2e7d32; }
.status-entregue { background: #eceff1; color: #546e7a; }
.status-cancelado { background: #ffebee; color: #c62828; }
.observacao { background: #fffde7; border: 1px solid #fff59d; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; white-space: pre-wrap; }
.caminho-arte { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 8px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.caminho-arte span { font-weight: 700; color: #2e7d32; }
.caminho-arte code { flex: 1; min-width: 200px; word-break: break-all; font-size: 13px; }
.caminho-arte .btn { padding: 4px 12px; font-size: 12px; }
.ajuste { background: #fff3e0; border: 1px solid #ffcc80; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.itens { display: grid; gap: 10px; }
.item { background: #fafafa; border: 1px solid #e5e5e5; border-radius: 9px; padding: 12px 14px; }
.item-desc { white-space: pre-wrap; font-size: 15px; margin-bottom: 8px; }
.item-desc strong { color: var(--cor-texto, var(--cor-escura)); }
.anexos { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.anexos-rotulo { font-size: 12px; font-weight: 700; color: #666; width: 100%; margin-top: 4px; }
.mini { position: relative; }
.mini a { display: block; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 2px solid #e0e0e0; background: white; }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini .pdf { display: flex; align-items: center; justify-content: center; height: 100%; font-weight: 800; color: #c62828; }
.mini a { text-decoration: none; }
.mini .ext { display: flex; align-items: center; justify-content: center; height: 62px; font-weight: 800; font-size: 15px; color: #37474f; letter-spacing: .5px; }
.mini .ext.pdf { height: 100%; color: #c62828; }
.mini small { display: block; text-align: center; font-size: 10px; color: #78909c; margin-top: -10px; }
.mini-nome { width: 84px; font-size: 10px; color: #666; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.removido a { border-style: dashed; background: #fafafa; opacity: .7; }
.envio-progresso { font-size: 12px; color: #555; align-self: center; }
.mini .mini-baixar { position: absolute; left: 4px; top: 58px; width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(0,0,0,.6); color: white; font-size: 14px; line-height: 24px; text-align: center; text-decoration: none; overflow: visible; }
.mini .mini-baixar:hover { background: var(--cor-escura, #333); }
.mini-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #d32f2f; color: white; cursor: pointer; font-weight: 700; line-height: 1; }
.finais .mini a { border-color: #66bb6a; }
.add-arquivo { display: inline-flex; align-items: center; justify-content: center; width: 84px; height: 84px; border: 2px dashed #bbb; border-radius: 8px; color: #777; font-size: 12px; text-align: center; cursor: pointer; background: white; padding: 4px; }
.add-arquivo:hover { border-color: var(--cor); color: var(--cor-texto, var(--cor-escura)); }
.add-arquivo input { display: none; }
.add-arquivo.enviando { pointer-events: none; border-color: var(--cor); color: var(--cor-texto, var(--cor-escura)); font-weight: 700; }
.acoes { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee; }
.btn { border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit; }
.btn-primary { background: var(--cor); color: white; }
.btn-success { background: #43A047; color: white; }
.btn-warning { background: #FB8C00; color: white; }
.btn-danger { background: white; color: #c62828; border: 1px solid #ef9a9a; }
.btn-secondary { background: #eceff1; color: #37474f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.historico { margin-top: 10px; font-size: 13px; color: #555; }
.historico summary { cursor: pointer; color: #777; }
.historico ul { margin: 8px 0 0 18px; display: grid; gap: 3px; }
.empty-state, .loading { text-align: center; padding: 60px 20px; color: #888; background: white; border-radius: 12px; }
.refresh-btn { position: fixed; right: 30px; bottom: 30px; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--cor); color: white; font-size: 24px; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,.3); }
.feedback { position: fixed; top: 20px; right: 20px; background: #43A047; color: white; padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 3000; max-width: 420px; }
.feedback.erro { background: #c62828; }
.login-overlay, .modal-overlay { position: fixed; inset: 0; background: rgba(20,20,40,.85); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box, .modal-box { width: 100%; max-width: 380px; background: white; border-radius: 14px; padding: 26px; box-shadow: 0 20px 50px rgba(0,0,0,.35); position: relative; }
.modal-box { max-width: 760px; max-height: 92vh; overflow-y: auto; }
.modal-close { position: absolute; top: 12px; right: 16px; background: transparent; border: none; font-size: 26px; cursor: pointer; color: #888; }
.login-box h2, .modal-box h2 { color: var(--cor-texto, var(--cor-escura)); margin-bottom: 6px; }
.login-box p { color: #777; margin-bottom: 18px; }
.login-box label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.login-box input { width: 100%; padding: 11px; border: 1px solid #ccc; border-radius: 8px; }
.login-box button { width: 100%; margin-top: 14px; padding: 12px; }
.login-error, .erro-form { color: #c62828; min-height: 20px; margin-top: 8px; font-size: 13px; font-weight: 600; }
.campo { display: block; margin-top: 14px; font-size: 13px; font-weight: 700; color: #444; }
.campo > input, .campo > select, .campo > textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 400; }
.campo textarea { resize: vertical; min-height: 64px; }
.dica { font-weight: 400; color: #888; }
.linha { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tipos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.tipos label { flex: 1; min-width: 120px; border: 2px solid #e0e0e0; border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; font-weight: 600; }
.tipos input { display: none; }
.tipos-arte { margin: 0 0 8px; }
.tipos-arte label { min-width: 100px; padding: 7px; font-size: 13px; border-width: 1px; }
.item-desc .chip { vertical-align: 1px; margin-left: 4px; }
.tipos label:has(input:checked) { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 10%, var(--mistura, white)); color: var(--cor-texto, var(--cor-escura)); }
.busca-cliente { position: relative; }
.resultados { position: absolute; left: 0; right: 0; top: 100%; background: white; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 260px; overflow-y: auto; z-index: 10; }
.resultados button { display: block; width: 100%; text-align: left; border: 0; background: white; padding: 10px 12px; cursor: pointer; font: inherit; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.resultados button:hover, .resultados button:focus { background: #f5f5f5; }
.resultados small { color: #888; display: block; }
.cliente-escolhido { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px; border: 2px solid var(--cor); border-radius: 8px; background: color-mix(in srgb, var(--cor) 8%, var(--mistura, white)); font-weight: 700; }
.cliente-escolhido small { display: block; font-weight: 400; color: #666; }
.novo-cliente { margin-top: 8px; padding: 12px; border: 1px dashed #bbb; border-radius: 8px; background: #fafafa; }
.arte-form { border: 1px solid #e0e0e0; border-radius: 10px; padding: 12px; margin-top: 10px; background: #fafafa; }
.arte-form-topo { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--cor-texto, var(--cor-escura)); }
.arte-form textarea { width: 100%; margin-top: 8px; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font: inherit; font-size: 14px; resize: vertical; min-height: 60px; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.visualizador { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 2600; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 12px; }
.visualizador img { max-width: 100%; max-height: 82vh; object-fit: contain; background: white; border-radius: 6px; }
.visualizador a, .visualizador button { color: white; }
.visualizador .fechar { position: absolute; top: 14px; right: 22px; background: none; border: 0; font-size: 34px; cursor: pointer; }
@media (max-width: 780px) {
    .header { text-align: left; padding-bottom: 60px; }
    .user-area { left: 20px; right: auto; top: auto; bottom: 12px; }
    .card-topo { flex-direction: column; }
    .linha { grid-template-columns: 1fr; }
    .container { padding: 0 12px 90px; }
}

/* Modo noturno (tema.js): o resto das cores é convertido na hora; estas usam var() e color-mix(). */
html[data-tema="escuro"] { --cor-texto: color-mix(in srgb, var(--cor) 45%, white); --mistura: #1c1e26; }

/* Entregar: um caminho por arte (no programa CorTex Pedidos, o cartão recebe o arquivo arrastado) */
.ent-arte { border: 2px dashed #ccc; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.ent-arte.soltar { border-color: var(--cor); background: color-mix(in srgb, var(--cor) 10%, var(--mistura, white)); }
.ent-arte-topo { font-size: 14px; word-break: break-word; }
.ent-arte-arquivos { font-size: 12px; color: #666; margin: 4px 0 6px; word-break: break-all; }
.ent-arte-campo { display: flex; gap: 8px; }
.ent-arte-campo input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid #ccc; border-radius: 8px; font: inherit; font-size: 13px; }
.ent-arte-aviso { color: #c62828; font-size: 12px; font-weight: 600; margin-top: 4px; }
.ent-arte-aviso:empty { display: none; }

/* Rascunho do novo pedido */
.aviso-rascunho { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 14px; padding: 9px 12px; border-radius: 8px; background: #fff8e1; border: 1px solid #ffe082; color: #6d4c00; font-size: 13px; }
.aviso-rascunho button { background: none; border: 0; color: #c62828; font-weight: 700; cursor: pointer; font-size: 13px; padding: 2px 4px; }
