/* ObraView — identidade visual
   Mundo da obra: azul-nanquim de planta (blueprint), âmbar de capacete no progresso,
   cinza-concreto nos neutros. O % é lido como um instrumento (fonte mono). */

:root {
  --ink: #0E2A47;
  --ink-700: #15355A;
  --ink-900: #091E33;
  --amber: #F4A210;
  --amber-600: #DD9009;
  --amber-100: #FCE7C2;
  --concrete: #EDF0F3;
  --card: #FFFFFF;
  --track: #DBE1E8;
  --line: #C9D2DB;
  --ink-text: #1A2A38;
  --muted: #5E6E7D;
  --ok: #1F7A4D;
  --danger: #C0392B;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14,42,71,.06), 0 8px 24px rgba(14,42,71,.07);
  --display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  color: var(--ink-text);
  background: var(--concrete);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== Topo (área interna) ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 18px;
  letter-spacing: .01em; color: #fff; text-decoration: none;
}
.topnav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.who { color: rgba(255,255,255,.7); }
.topnav .ghost { color: #fff; opacity: .85; text-decoration: none; }
.topnav .ghost:hover { opacity: 1; text-decoration: underline; }

.wrap { max-width: 720px; margin: 0 auto; padding: 18px 16px 56px; }

/* ===== Tipografia / utilidades ===== */
.h1 { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--ink); margin: 0 0 4px; letter-spacing: -.01em; }
.h2 { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.pagehead { margin: 8px 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.erro { background: #FDEAE7; color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 10px 0; }
.ok { background: #E6F4EC; color: var(--ok); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 10px 0; }
code { font-family: var(--mono); font-size: .9em; background: #EEF2F6; padding: 1px 5px; border-radius: 5px; }

.card {
  background: var(--card); border: 1px solid #E6EBF0; border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.narrow { max-width: 420px; margin: 8vh auto 0; }

/* ===== Botões ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--amber); color: #2A1A00; border: none;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  padding: 11px 18px; border-radius: 10px; cursor: pointer; text-decoration: none;
  transition: transform .04s ease, background .15s ease;
}
.btn:hover { background: var(--amber-600); }
.btn:active { transform: translateY(1px); }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

.mini {
  background: #EEF2F6; color: var(--ink); border: 1px solid var(--line);
  font-family: var(--body); font-weight: 600; font-size: 13px;
  padding: 7px 11px; border-radius: 8px; cursor: pointer;
}
.mini.on { background: var(--amber-100); border-color: var(--amber); color: #7A4E00; }
.mini.danger { color: var(--danger); padding: 7px 10px; }
.link-danger { background: none; border: none; color: var(--danger); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; align-self: flex-start; }

a.ghost { color: var(--ink); text-decoration: none; font-weight: 500; }
a.ghost:hover { text-decoration: underline; }

/* ===== Formulários ===== */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.form input, .form select,
.form-inline input, .copybox input {
  font-family: var(--body); font-size: 15px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink-text); width: 100%;
}
.form input:focus, .form select:focus, .form-inline input:focus, .copybox input:focus {
  outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--amber);
}
.form .btn { align-self: flex-start; }
.brand-big { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--ink); letter-spacing: -.01em; margin-bottom: 4px; }

.novo { margin-bottom: 16px; }
.novo .form.card { margin-top: 12px; }

.form-inline { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.form-inline input[name="nome"] { flex: 1; min-width: 160px; }
.peso-input { width: 84px; flex: 0 0 auto; }
.form-inline .btn { flex: 0 0 auto; }

/* ===== Cards de empreendimento ===== */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.emp-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .06s; }
.emp-card:hover { border-color: var(--amber); }
.emp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pct-badge { font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--ink); background: var(--amber-100); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ===== Barra de progresso ===== */
.bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--amber-600)); border-radius: 999px; transition: width .6s cubic-bezier(.22,.61,.36,1); }
.bar.big { height: 12px; }

/* ===== Medidor (área interna) ===== */
.gauge { display: flex; align-items: center; gap: 18px; }
.gauge-num { font-family: var(--mono); font-weight: 700; font-size: 44px; line-height: 1; color: var(--ink); display: flex; align-items: flex-start; }
.gauge-num span { font-size: 18px; margin: 4px 0 0 2px; color: var(--amber-600); }
.gauge-body { flex: 1; }
.gauge-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }

/* ===== Caixa de copiar link ===== */
.copybox { display: flex; gap: 8px; margin-top: 10px; }
.copybox input { font-family: var(--mono); font-size: 13px; background: #F7F9FB; }
.copybox .btn { flex: 0 0 auto; }

/* ===== Linha do tempo (etapas) ===== */
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 4px 0 16px 26px; align-items: flex-start; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.dot { position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: #fff; box-sizing: border-box; transition: all .2s; }
.timeline li.done .dot { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-100); }
.tl-main { flex: 1; min-width: 0; }
.tl-nome { font-weight: 600; color: var(--ink); font-size: 15px; }
.peso { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.tl-data { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-data.pend { color: var(--amber-600); }
.tl-acoes { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.tl-acoes form { margin: 0; }

/* ===== Galeria de fotos ===== */
.upload { margin-top: 12px; }
.file input[type="file"] { font-size: 14px; }
.galeria { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.galeria figure { margin: 0; background: #F7F9FB; border: 1px solid #E6EBF0; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--track); }
.galeria figcaption { padding: 8px 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.galeria figcaption form { margin: 0; }
.tag { align-self: flex-start; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; letter-spacing: .02em; }
.leg { color: var(--ink-text); }
.data { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.voltar { display: inline-block; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.voltar:hover { color: var(--ink); }

.vazio { text-align: center; padding: 36px 18px; }
.vazio-titulo { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 16px; margin: 0 0 4px; }

/* ===== Visão pública (comprador) ===== */
body.publico { background: var(--concrete); }
.pub-hero {
  background: linear-gradient(160deg, var(--ink), var(--ink-900));
  color: #fff; border-radius: 18px; padding: 28px 22px 24px;
  margin: 6px 0 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.pub-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 22px 22px;
}
.pub-brand { position: relative; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); }
.pub-titulo { position: relative; font-family: var(--display); font-weight: 700; font-size: 24px; margin: 8px 0 2px; color: #fff; }
.pub-end { position: relative; color: rgba(255,255,255,.7); font-size: 13px; margin: 0 0 16px; }
.pub-gauge { position: relative; display: flex; align-items: baseline; gap: 12px; margin-top: 8px; }
.pub-num { font-family: var(--mono); font-weight: 700; font-size: 60px; line-height: .9; color: #fff; display: flex; align-items: flex-start; }
.pub-num span { font-size: 22px; color: var(--amber); margin-top: 6px; }
.pub-glabel { font-size: 13px; color: rgba(255,255,255,.75); max-width: 120px; line-height: 1.3; }
.bar.big.light { position: relative; margin-top: 16px; background: rgba(255,255,255,.16); }
.bar.big.light > span { background: linear-gradient(90deg, var(--amber), #FFC257); }

.pub-sec { margin: 0 0 22px; }
.pub-h2 { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 0 8px; border-top: 1px solid var(--line); margin-top: 8px; }

/* ===== Foco acessível ===== */
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ===== Telas maiores ===== */
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .galeria { grid-template-columns: repeat(3, 1fr); }
  .gauge-num { font-size: 52px; }
  .pub-num { font-size: 72px; }
  .pub-titulo { font-size: 28px; }
}

/* ===== Movimento reduzido ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
