:root {
  --navy: #1c3d5e; --navy-deep: #142c45; --ink: #1b2430; --muted: #5b6573;
  --paper: #fbf8f3; --card: #fff; --line: #e6e0d6;
  --red: #c8285a; --yellow: #e9cf3c; --blue: #2459d6; --green: #1f7a8c; --orange: #e0743a; --sky: #8fd0dc;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding: 36px 20px 64px; width: 100%; }
h1, h2, h3 { font-family: 'Bree Serif', Georgia, serif; font-weight: 400; color: var(--navy); line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--blue); }
.wrap { max-width: 1120px; margin: 0 auto; }
.topo .wrap, .rodape .wrap { padding: 0 20px; }
.muted, .empty { color: var(--muted); font-size: .9rem; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Cabeçalho */
.spines { display: flex; height: 5px; }
.spines span { flex: 1; }
.spines span:nth-child(6n+1) { background: var(--green); } .spines span:nth-child(6n+2) { background: var(--yellow); }
.spines span:nth-child(6n+3) { background: var(--red); } .spines span:nth-child(6n+4) { background: var(--blue); }
.spines span:nth-child(6n+5) { background: var(--orange); } .spines span:nth-child(6n+6) { background: var(--sky); }
.topo { background: #fff; box-shadow: 0 1px 0 var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { height: 48px; width: auto; }
.brand .tag { font-size: .8rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--red); border-left: 1px solid var(--line); padding-left: 14px; }
.user { display: flex; align-items: center; gap: 14px; font-size: .88rem; color: var(--muted); flex-wrap: wrap; }
.user b { color: var(--navy); font-weight: 600; display: block; line-height: 1.2; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; flex-shrink: 0; }
.sair { color: var(--muted); font-size: .85rem; }
.admin-nav { display: flex; gap: 18px; }
.admin-nav a { color: var(--navy); text-decoration: none; font-weight: 500; }
.admin-nav a:hover { color: var(--red); }

.rodape { background: var(--navy); color: rgba(255,255,255,.75); font-size: .85rem; }
.rodape .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 20px; padding-bottom: 20px; }
.rodape a { color: #fff; }

/* Avisos */
.aviso { padding: 12px 16px; border-radius: 10px; margin: 0 0 22px; font-weight: 500; }
.aviso-ok { background: #e6f4ec; color: #1d5e3c; }
.aviso-erro { background: #fbe9ee; color: #8f1d41; }
.aviso-info { background: #e8f0fb; color: #1c3d5e; }
.senha-gerada { font: 600 1.3rem ui-monospace, Consolas, monospace; letter-spacing: .05em; background: #fff; border: 1px dashed var(--navy); padding: 4px 12px; border-radius: 8px; display: inline-block; margin-top: 6px; user-select: all; }

/* Botões e formulários */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font: 600 .95rem Inter, sans-serif; border: 0; cursor: pointer; text-decoration: none; background: var(--navy); color: #fff; }
.btn:hover { background: var(--navy-deep); }
.btn svg { width: 18px; height: 18px; }
.btn.sec { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
.btn.peq { padding: 8px 16px; font-size: .85rem; }
.btn.perigo { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }
.link-btn.perigo { color: var(--red); }
form.inline { display: inline; }
label { display: grid; gap: 6px; font-size: .88rem; font-weight: 500; }
input, select, textarea { font: inherit; padding: 11px 13px; border: 1px solid #d3ccc0; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 90px; resize: vertical; }
.campos { display: grid; gap: 14px; }
.campos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.campos-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ajuda { font-size: .82rem; color: var(--muted); font-weight: 400; }
.caixa { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.caixa + .caixa { margin-top: 20px; }

/* Login */
.login { max-width: 420px; margin: 20px auto; }
.login h1 { margin-bottom: 6px; }
.login p { color: var(--muted); margin: 0 0 22px; }
.login .btn { width: 100%; margin-top: 4px; }
.login .rodape-login { font-size: .88rem; margin: 20px 0 0; text-align: center; }

/* Painel do cliente */
.hello { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.hello p { margin: 6px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 4px solid var(--c); }
.stat span { font-size: .8rem; color: var(--muted); }
.stat b { display: block; font-family: 'Bree Serif', serif; font-weight: 400; font-size: 1.8rem; color: var(--navy); line-height: 1.2; }
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
.list h2 { margin-bottom: 12px; }
.quote { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; transition: border-color .15s, box-shadow .15s; }
.quote:hover { border-color: #cfc6b6; }
.quote[aria-current="page"] { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy) inset; }
.quote .code { font-size: .78rem; color: var(--muted); font-weight: 600; letter-spacing: .04em; display: flex; justify-content: space-between; }
.quote .title { display: block; font-weight: 600; color: var(--navy); margin: 2px 0 8px; line-height: 1.35; }
.quote .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, white); color: color-mix(in srgb, var(--c) 75%, black); white-space: nowrap; }
.badge { background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; letter-spacing: 0; }
.mini { display: block; height: 4px; background: #eee7da; border-radius: 4px; margin-top: 10px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--c); border-radius: 4px; }

.detail { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.detail-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.detail-head .code { font-size: .8rem; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.facts { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 12px; font-size: .88rem; color: var(--muted); }
.facts b { display: block; color: var(--ink); font-size: 1rem; }
.cols { display: grid; grid-template-columns: 1.15fr .85fr; gap: 32px; }

/* Linha do tempo */
.timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 24px 44px; }
.timeline li::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li.done::before { background: var(--green); }
.dot { position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); color: #b9b0a0; }
.dot svg { width: 15px; height: 15px; }
.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.current .dot { border-color: var(--red); color: var(--red); box-shadow: 0 0 0 5px color-mix(in srgb, var(--red) 15%, white); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--red) 6%, white); } }
.step-title { font-weight: 600; color: var(--navy); line-height: 30px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pending .step-title { color: #a39a8b; font-weight: 500; }
.step-date { font-size: .8rem; color: var(--muted); font-weight: 500; }
.step-note { font-size: .9rem; color: var(--muted); margin: 2px 0 0; }
.now { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; background: var(--red); color: #fff; padding: 2px 8px; border-radius: 999px; line-height: 1.6; }

.timeline li.fim .dot { background: #8a8f98; border-color: #8a8f98; color: #fff; }
.timeline li.fim .step-title { color: #4b5260; }
.timeline.encerrada li:nth-last-child(2)::before { background: var(--line); }
.aviso-cinza { background: #eef0f2; color: #3d4450; }

/* Abas Cotações / Pedidos / Encerradas */
.abas { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.abas a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.abas a:hover { color: var(--navy); }
.abas a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--red); }
.abas .n { display: inline-block; background: #eee7da; color: var(--navy); border-radius: 999px; padding: 0 7px; font-size: .72rem; margin-left: 4px; }
.tipo { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }

/* Documentos e mensagens */
.side h3 { margin: 16px 0 10px; }
.docs { list-style: none; margin: 0 0 22px; padding: 0; }
.docs li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; font-size: .9rem; }
.docs .info { flex: 1; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.docs small { display: block; color: var(--muted); }
.docs a { color: var(--blue); font-weight: 600; font-size: .85rem; text-decoration: none; }
.file-ico { width: 38px; height: 44px; border-radius: 4px; font-size: .58rem; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; background: #fbeaea; color: #b4232a; }
.file-ico.planilha { background: #e6f4ec; color: #1f7a4c; }
.file-ico.imagem { background: #e8f0fb; color: #2459d6; }
.msgs { display: grid; gap: 8px; margin-bottom: 12px; max-height: 420px; overflow-y: auto; }
.msg { border-radius: 10px; padding: 10px 14px; font-size: .9rem; max-width: 92%; }
.msg small { display: block; color: var(--muted); font-size: .76rem; margin-bottom: 2px; }
.msg.delmoco { background: #f3eee4; }
.msg.cliente { background: #e8f0fb; justify-self: end; }
.side textarea { min-height: 80px; }
.side .btn { margin-top: 10px; }

/* Painel da equipe */
.barra-acoes { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filtros input, .filtros select { width: auto; min-width: 180px; }
.tabela-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; background: #faf7f1; }
tr:last-child td { border-bottom: 0; }
td a.forte { font-weight: 600; color: var(--navy); text-decoration: none; }
td a.forte:hover { color: var(--red); }
.inativo td { opacity: .55; }
.grade-admin { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }
.grade-admin .caixa + .caixa { margin-top: 0; }
.col-pilha { display: grid; gap: 20px; }
.relatorio { list-style: none; padding: 0; margin: 12px 0 0; font-size: .88rem; }
.relatorio li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.relatorio .erro { color: #8f1d41; }
code { background: #f1ece2; padding: 1px 6px; border-radius: 5px; font-size: .85em; }

@media (max-width: 900px) {
  .layout, .cols, .grade-admin { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .brand .tag, .user .who { display: none; }
  .detail, .caixa { padding: 20px; }
  .campos-2, .campos-3 { grid-template-columns: 1fr; }
  .admin-nav { gap: 12px; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) { .current .dot { animation: none; } }
