/* SyncBuild 4D — identidade 1c (monograma S), paleta Roxo técnico. */
/* Fontes locais (SIL OFL, ver /vendor/fonts): a CSP só aceita arquivos do próprio domínio. Subconjunto latin. */
@font-face { font-family: Manrope; font-style: normal; font-weight: 400 800; font-display: swap; src: url("../vendor/fonts/manrope-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-mono-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #14111c; --surface: #1d1726; --surface2: #2a2235; --ink: #eeeaf4; --muted: #aca1ba; --line: #382d45;
  --accent: #b58ad9; --accent2: #7530a0; --accent-soft: #30223f; --onaccent: #fff;
  --primary: #7530a0; --primary-hover: #8840b4;
  --prog: #E3A600; --crit: #C23B3B; --crit-soft: #512b37; --ok: #2E8B57; --bar: #72518d; --warn: #deb55f; --view: #17121f;
  --radius: 6px; --shadow: 0 1px 2px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.14);
  --f: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font-family: var(--f); font-size: 14px; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--surface); border-bottom: 3px solid var(--primary); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { height: 36px; width: 36px; }
.brand b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; } .brand small { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.crumbs { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--crit); border-color: var(--crit); } .btn.small { padding: 5px 10px; font-size: 12px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); padding: 4px 8px; border-radius: 4px; } .icon-btn:hover { background: var(--surface2); }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; } .field-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; } .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .grow { flex: 1; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.chip.admin { background: var(--primary); color: #fff; } .chip.planner { background: var(--accent-soft); color: var(--accent); } .chip.client { background: var(--surface2); color: var(--ink); }
.chip.ok { background: rgba(46,139,87,.14); color: var(--ok); } .chip.warn { background: rgba(227,166,0,.18); color: var(--warn); } .chip.bad { background: rgba(194,59,59,.14); color: var(--crit); }

/* ---------- layout ---------- */
.page { max-width: 1480px; margin: 0 auto; padding: 20px 16px 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { margin-bottom: 10px; } .card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); } .g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; border-top: 3px solid var(--accent); }
.kpi .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; } .kpi .l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; } .kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad { border-top-color: var(--crit); } .kpi.ok { border-top-color: var(--ok); } .kpi.warn { border-top-color: var(--prog); }

/* ---------- home ---------- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--accent); box-shadow: var(--shadow); } .pcard h3 { font-size: 16px; } .pcard .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.banner { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- projeto ---------- */
.proj { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 59px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 59px; height: calc(100vh - 59px); overflow: auto; }
.side .ptitle { padding: 4px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; } .side .ptitle b { display: block; font-size: 15px; } .side .ptitle span { font-size: 12px; color: var(--muted); }
.side a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 5px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 13px; }
.side a:hover { background: var(--surface2); } .side a.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 var(--primary); }
.side a i { font-style: normal; width: 18px; text-align: center; opacity: .8; } .side .sep { height: 1px; background: var(--line); margin: 8px 4px; }
.content { padding: 18px 20px 48px; min-width: 0; }
.content > .head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.content > .head p { margin: 4px 0 0; color: var(--muted); }
@media (max-width: 900px) {
  .proj { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  .side .ptitle, .side .sep { display: none; } .side a { flex: none; } .g2 { grid-template-columns: 1fr; } .brand small, .user .uname { display: none; }
}

/* ---------- visualizador ---------- */
.viewer-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.viewer { position: relative; height: min(68vh, 760px); min-height: 380px; background: var(--view); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.viewer-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.vover { position: absolute; left: 12px; top: 10px; pointer-events: none; } .vover .d { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; } .vover .s { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.render-on .vover .d, .render-on .vover .s { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.vtools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 70%; }
.vtools .btn { padding: 6px 10px; font-size: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); }
.vlegend { position: absolute; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; max-width: calc(100% - 20px); }
.vlegend span { display: flex; gap: 6px; align-items: center; } .vlegend i { width: 10px; height: 10px; border-radius: 2px; }
.vload { position: absolute; inset: 0; display: grid; place-items: center; background: var(--view); color: var(--muted); font-weight: 700; text-align: center; padding: 20px; }
.timebar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; } .timebar input[type=range] { flex: 1 1 300px; accent-color: var(--primary); }
.vside { display: flex; flex-direction: column; gap: 12px; min-width: 0; } .vside .card { padding: 12px; }
.runlist { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; }
.ri { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 13px; cursor: pointer; } .ri small { color: var(--muted); display: block; font-size: 11px; }
.mini-bar { grid-column: 1 / -1; height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; } .mini-bar i { display: block; height: 100%; background: var(--prog); }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 8px 0 0; font-size: 12px; } dl.kv dt { color: var(--muted); font-weight: 700; } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .viewer-wrap { grid-template-columns: 1fr; } }

/* ---------- tabelas ---------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: 560px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { position: sticky; top: 0; background: var(--surface); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; z-index: 1; }
.tbl td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; } .tbl tr:hover td { background: var(--surface2); }
.tbl input[type=number] { width: 80px; padding: 4px 6px; } .tbl select { max-width: 360px; padding: 4px 6px; }

/* ---------- gantt ---------- */
.gantt { height: min(70vh, 780px); min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.gantt-canvas { display: block; cursor: grab; } .gantt-canvas:active { cursor: grabbing; }

/* ---------- auditor ---------- */
.gauge { display: flex; align-items: center; gap: 18px; } .gauge .ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.gauge .ring div { width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.crit-list { display: flex; flex-direction: column; gap: 8px; } .crit { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); border-left: 4px solid var(--ok); }
.crit.atencao { border-left-color: var(--prog); } .crit.falha { border-left-color: var(--crit); } .crit p { margin: 2px 0 0; font-size: 13px; color: var(--muted); } .crit .rec { color: var(--ink); }
.pbar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: 6px; } .pbar i { display: block; height: 100%; background: var(--accent); }

/* ---------- componentes ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(10,20,30,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 8px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(1040px, 100%); } .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; } .modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 6px; max-width: 380px; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast.error { background: var(--crit); color: #fff; } .toast.ok { background: var(--ok); color: #fff; } .toast.out { opacity: 0; transform: translateY(8px); }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 4px; font-size: 12px; max-width: 320px; line-height: 1.35; }
.empty { text-align: center; padding: 36px 16px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); } .empty p { color: var(--muted); max-width: 60ch; margin: 8px auto 14px; }
.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 24px; } .spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.pb { display: flex; flex-direction: column; gap: 4px; } .pb-track { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; } .pb-track i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; } .pb-label { font-size: 12px; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.step .n { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; } .step.done { border-color: var(--ok); } .step.done .n { color: var(--ok); }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: center; }
.login { max-width: 460px; margin: 10vh auto; text-align: center; } .login img { width: 160px; margin-bottom: 16px; }
.photo { position: fixed; inset: 0; z-index: 55; background: rgba(10,20,30,.85); display: grid; place-items: center; padding: 16px; } .photo img, .photo video { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 6px; }
.busy { opacity: .6; pointer-events: none; cursor: progress; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- pré-visualização por papel ---------- */
.content-wrap { min-width: 0; }
.banner.preview { margin: 14px 20px 0; border-color: var(--prog); background: rgba(227,166,0,.12); }
.viewas { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.viewas select { font-size: 13px; padding: 5px 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }
@media (max-width: 900px) { .banner.preview { margin: 10px 12px 0; } }

/* Entrada pública; os dados permanecem protegidos pela sessão. */
.auth-page{min-height:100vh;display:grid;place-items:center;padding:32px 16px;background:var(--bg)}
.auth-card{width:min(100%,460px);padding:30px;background:var(--surface);border:1px solid var(--line);border-top:3px solid var(--primary);border-radius:8px;box-shadow:var(--shadow)}
.auth-brand{display:flex;align-items:center;gap:12px;margin-bottom:28px}.auth-brand b{display:block;font-size:20px}.auth-brand small{color:var(--muted);text-transform:uppercase;letter-spacing:.08em;font-size:11px}.auth-card h1{font-size:24px}.auth-tabs{display:flex;gap:8px;margin:24px 0 20px}.auth-tabs .btn{flex:1;justify-content:center}.auth-form{display:grid;gap:16px}.auth-form input{width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:6px;background:var(--bg)}.auth-form .btn{justify-content:center;min-height:44px}.auth-error{color:#ffb0ba;margin:0}.auth-trap{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
