:root {
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --surface-2: #F4F6F9;
  --ink: #16202E;
  --muted: #5C6B7D;
  --faint: #93A0B0;
  --line: #E0E5EC;
  --line-strong: #C9D1DC;
  --accent: #1E5FA8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4EEF9;
  --ok: #2E9E5B;
  --ok-ink: #FFFFFF;
  --ok-soft: #E3F3E9;
  --bad: #C6483C;
  --shadow: 0 1px 2px rgba(22,32,46,.05), 0 8px 24px rgba(22,32,46,.07);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F151D; --surface: #1A222D; --surface-2: #141B24; --ink: #E9EEF4;
    --muted: #9DABBC; --faint: #647486; --line: #2A333F; --line-strong: #3A4653;
    --accent: #4E93DE; --accent-ink: #0B1017; --accent-soft: #1B2C40;
    --ok: #4FBE7C; --ok-ink: #08130C; --ok-soft: #16301F; --bad: #E58379;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }


body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.app { max-width: 620px; margin: 0 auto; padding-bottom: 96px; }

/* ---------- Appbar (azul) ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px rgba(22,32,46,.12); }
.appbar-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.appbar .logo { width: 45px; height: 45px; border-radius: 8px; flex: none; display: grid; place-items: center; background: rgba(225,225,225); }
.appbar .logo svg { display: block; }
.appbar-title { font-weight: 800; font-size: 15px; }
.appbar-sub { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .82; margin-top: 1px; }
.appbar-user { margin-left: auto; text-align: right; font-size: 11px; opacity: .95; }
.appbar-user a { color: var(--accent-ink); font-weight: 700; text-decoration: underline; }
.role-badge { font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.2); }
.back-link { color: var(--accent-ink); text-decoration: none; font-size: 22px; line-height: 1; opacity: .95; padding-right: 2px; }

/* ---------- Cabeçalho de página ---------- */
.page-head { padding: 16px 16px 6px; }
.eyebrow { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 2px 0; }
.page-sub { font-size: 13px; color: var(--muted); }

.list { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 44px 24px; font-size: 14px; line-height: 1.6; }

/* ---------- Card de obra ---------- */
.card-obra { display: flex; align-items: center; gap: 12px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px; }
.card-obra:active { transform: scale(.995); }
.card-obra-info { flex: 1; min-width: 0; }
.card-obra-name { font-size: 16px; font-weight: 700; }
.card-obra-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.count-pill { text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; }
.count-pill b { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.count-pill span { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.chev { color: var(--faint); font-size: 20px; }

/* ---------- Serviço (accordion) ---------- */
.servico { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.servico-head { display: flex; align-items: center; gap: 12px; padding: 14px 15px; cursor: pointer; user-select: none; }
.servico-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.caret { flex: none; color: var(--faint); transition: transform .2s; font-size: 12px; }
.servico.open .caret { transform: rotate(90deg); }
.servico-info { flex: 1; min-width: 0; }
.servico-name { font-size: 15.5px; font-weight: 700; }
.servico-prog { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; flex: 1; max-width: 150px; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .4s; }
.servico-count { font-variant-numeric: tabular-nums; }
.servico-badge { flex: none; font-size: 12px; font-weight: 800; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); min-width: 34px; text-align: center; padding: 4px 9px; border-radius: 999px; }
.servico-badge.done { color: var(--ok); background: var(--ok-soft); border-color: transparent; font-size: 14px; }

.tarefas { display: none; flex-direction: column; border-top: 1px solid var(--line); }
.servico.open .tarefas { display: flex; }
.servico-desc { font-size: 12.5px; color: var(--muted); padding: 12px 15px 2px; }

/* ---------- Tarefa ---------- */
.tarefa { display: flex; align-items: flex-start; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.tarefa:last-child { border-bottom: 0; }
.check {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong);
  background: var(--surface); color: transparent; cursor: pointer; display: grid; place-items: center;
  transition: .15s; margin-top: 1px;
}
.check svg { opacity: 0; transition: opacity .12s; }
.check:active { transform: scale(.9); }
.tarefa.feita .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.tarefa.feita .check svg { opacity: 1; }
.tarefa-body { flex: 1; min-width: 0; }
.tarefa-titulo { font-size: 14.5px; }
.tarefa.feita .tarefa-titulo { color: var(--muted); }
.tarefa-descricao { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tarefa-assinatura { font-size: 11.5px; color: var(--ok); font-weight: 600; margin-top: 3px; min-height: 0; }
.tarefa-assinatura:empty { display: none; }
.mini-del { border: 0; background: none; color: var(--faint); font-size: 14px; cursor: pointer; padding: 4px; line-height: 1; }
.mini-del:hover { color: var(--bad); }
.tarefa-vazia { font-size: 13px; color: var(--faint); padding: 14px 15px; font-style: italic; }

/* ---------- Formulários inline (admin) ---------- */
.inline-add-col { display: flex; flex-direction: column; gap: 8px; padding: 12px 15px; border-top: 1px solid var(--line); background: var(--surface-2); }
.inline-add-row { display: flex; gap: 8px; }
.inline-add-col input { flex: 1; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; padding: 10px 11px; }
.inline-add-col input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.inline-add-col button { border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 16px; cursor: pointer; white-space: nowrap; }
.servico-del-row { padding: 8px 15px 12px; background: var(--surface-2); }
.link-del { border: 0; background: none; color: var(--bad); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 0; text-decoration: underline; }

/* ---------- Dock + botões ---------- */
.dock { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); max-width: 620px; margin: 0 auto; display: flex; gap: 10px; }
.btn { min-height: 50px; border-radius: 12px; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: var(--surface-2); color: var(--ink); text-decoration: none; padding: 0 18px; }
.btn.wide { width: 100%; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); flex: 1.4; }
.btn.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-strong); }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.dialog-body h3 { margin: 0 0 6px; font-size: 18px; }
.dialog-body label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.dialog-body input { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: inherit; padding: 11px; }
.dialog-body input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 12px; }
.dialog-actions .btn { flex: 1; min-height: 46px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.erro { background: var(--bad); color: #fff; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 24px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--withe); display: grid; place-items: center; }
.login-brand .logo svg { display: block; }
.brand-name { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.brand-name span { color: var(--accent); }
.brand-sub { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-top: 1px; }
.login-card h1 { font-size: 19px; margin: 0 0 2px; }
.login-card p.sub { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input { border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 15px; padding: 12px 13px; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.login-err { font-size: 13px; color: var(--bad); background: rgba(198,72,60,.12); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.login-btn { width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.login-foot { font-size: 11.5px; color: var(--faint); margin-top: 16px; text-align: center; line-height: 1.5; }
.logo-img{width: 34px;height: 34px;border-radius: 9px;background: var(--accent);display: grid;place-items: center;}
/* ---------- Responsividade ---------- */
img, svg { max-width: 100%; height: auto; }
body { overflow-x: hidden; }
.card-obra-name, .servico-name, .tarefa-titulo, .tarefa-descricao,
.servico-desc, .page-title, .appbar-title { overflow-wrap: anywhere; }
.appbar-title { line-height: 1.2; }

@media (max-width: 400px) {
  .appbar-row { gap: 8px; padding: 10px 12px; }
  .appbar .logo { width: 34px; height: 34px; }
  .appbar-user { font-size: 10px; }
  .page-head { padding: 12px 12px 4px; }
  .page-title { font-size: 20px; }
  .list { padding: 8px; }
  .servico-head, .tarefa, .inline-add-col { padding-left: 12px; padding-right: 12px; }
  .dock { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .btn { font-size: 14px; padding: 0 12px; }
  .bar { max-width: 90px; }
}
/* telas largas: coluna centralizada com respiro */
@media (min-width: 680px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
}

/* ---------- PWA: banner instalar / tutorial ---------- */
.pwa-sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.pwa-backdrop { position: absolute; inset: 0; background: rgba(10,16,24,.5); opacity: 0; transition: opacity .25s; }
.pwa-sheet-wrap.show .pwa-backdrop { opacity: 1; }
.pwa-sheet {
  position: relative; width: min(480px, 100%); background: var(--surface); color: var(--ink);
  border-radius: 20px 20px 0 0; box-shadow: 0 -8px 40px rgba(0,0,0,.25);
  padding: 22px 22px calc(24px + env(safe-area-inset-bottom)); text-align: center;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.pwa-sheet-wrap.show .pwa-sheet { transform: translateY(0); }
.pwa-x { position: absolute; top: 12px; right: 14px; border: 0; background: none; color: var(--faint); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px; }
.pwa-logo { display: flex; justify-content: center; margin-bottom: 12px; }
.pwa-logo img { border-radius: 12px; box-shadow: var(--shadow); }
.pwa-title { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.pwa-text { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.pwa-btn { width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.pwa-later { width: 100%; margin-top: 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 10px; }
.pwa-steps { text-align: left; margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.45; }
.pwa-steps b { font-weight: 700; }
.pwa-ic { display: inline-block; }
.pwa-hint { font-size: 12.5px; color: var(--muted); margin: 4px 0 16px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


















