/* OSXP — layout simples, mobile-first, alto contraste e alvos de toque grandes */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --line: #e2e6ec;
  --primary: #1f6feb;
  --primary-dark: #1558c0;
  --primary-soft: #e8f0fe;
  --green: #1a7f4b; --green-soft: #e3f5ea;
  --red: #c62f2f; --red-soft: #fdeaea;
  --orange: #b85c00; --orange-soft: #fff1e0;
  --yellow: #8a6a00; --yellow-soft: #fff7d1;
  --purple: #6b3fc4; --purple-soft: #f0eafd;
  --blue: #1f6feb; --blue-soft: #e8f0fe;
  --gray: #5d6878; --gray-soft: #eef0f3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --nav-h: 64px;
  --nav-bg: #0f172a; --nav-bg-2: #1e293b; --nav-text: #e2e8f0; --nav-muted: #94a3b8;
  --input-bg: #ffffff; --input-border: #cfd5de; --subtle: #fafbfc; --hover: #f6f8fa;
  --primary-text: #1558c0;
  --green-line: #bfe5cd; --red-line: #f1c4c4; --orange-line: #f5d3a8; --blue-line: #c6d9fb;
  color-scheme: light;
}

/* ── Tema escuro (manual ou automático pelo sistema) ─────── */
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #131c2e; --text: #e5e9f0; --muted: #94a3b8; --line: #243049;
  --primary: #4c8dff; --primary-dark: #3b7bf0; --primary-soft: rgba(76,141,255,.16); --primary-text: #8ab4ff;
  --green: #4ade80; --green-soft: rgba(74,222,128,.13);
  --red: #f87171; --red-soft: rgba(248,113,113,.14);
  --orange: #fb923c; --orange-soft: rgba(251,146,60,.14);
  --yellow: #facc15; --yellow-soft: rgba(250,204,21,.12);
  --purple: #c4b5fd; --purple-soft: rgba(167,139,250,.16);
  --blue: #8ab4ff; --blue-soft: rgba(76,141,255,.16);
  --gray: #a3aec2; --gray-soft: rgba(148,163,184,.14);
  --input-bg: #0f1726; --input-border: #2c3a55; --subtle: #0f1726; --hover: #182338;
  --green-line: rgba(74,222,128,.3); --red-line: rgba(248,113,113,.35); --orange-line: rgba(251,146,60,.35); --blue-line: rgba(76,141,255,.35);
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --nav-bg: #070c17; --nav-bg-2: #131c2e;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0b1120; --surface: #131c2e; --text: #e5e9f0; --muted: #94a3b8; --line: #243049;
    --primary: #4c8dff; --primary-dark: #3b7bf0; --primary-soft: rgba(76,141,255,.16); --primary-text: #8ab4ff;
    --green: #4ade80; --green-soft: rgba(74,222,128,.13);
    --red: #f87171; --red-soft: rgba(248,113,113,.14);
    --orange: #fb923c; --orange-soft: rgba(251,146,60,.14);
    --yellow: #facc15; --yellow-soft: rgba(250,204,21,.12);
    --purple: #c4b5fd; --purple-soft: rgba(167,139,250,.16);
    --blue: #8ab4ff; --blue-soft: rgba(76,141,255,.16);
    --gray: #a3aec2; --gray-soft: rgba(148,163,184,.14);
    --input-bg: #0f1726; --input-border: #2c3a55; --subtle: #0f1726; --hover: #182338;
    --green-line: rgba(74,222,128,.3); --red-line: rgba(248,113,113,.35); --orange-line: rgba(251,146,60,.35); --blue-line: rgba(76,141,255,.35);
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --nav-bg: #070c17; --nav-bg-2: #131c2e;
    color-scheme: dark;
  }
}
/* Documentos (orçamento/OS/comprovante) são sempre claros: impressão e link do cliente */
.doc {
  --bg: #f5f6f8; --surface: #fff; --text: #1c2430; --muted: #5d6878; --line: #e2e6ec;
  --primary: #1f6feb; --primary-soft: #e8f0fe; --input-bg: #fff; --input-border: #cfd5de; --subtle: #fbfcff;
  --green: #1a7f4b; --green-soft: #e3f5ea; --red: #c62f2f; --red-soft: #fdeaea; --gray: #5d6878; --gray-soft: #eef0f3;
  --blue: #1f6feb; --blue-soft: #e8f0fe; --orange: #b85c00; --orange-soft: #fff1e0; --yellow: #8a6a00; --yellow-soft: #fff7d1;
  --purple: #6b3fc4; --purple-soft: #f0eafd;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

/* ── Estrutura ───────────────────────────────────────────── */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--nav-bg); color: var(--nav-text);
  display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 60px;
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 2px 8px rgba(0,0,0,.18);
}
.topbar .brand { color: #fff; flex: none; }
.topbar .brand span { color: #6ea8ff; }
.topbar .spacer { flex: 1; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.02em; }
.brand span { color: var(--primary); }
.topbar form { margin: 0; }
.main { padding: 16px 16px calc(var(--nav-h) + 24px); width: 100%; min-width: 0; }

.sidenav { display: none; }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: var(--nav-h);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .72rem; font-weight: 600; text-decoration: none;
}
.bottomnav a.active { color: var(--primary); }
.bottomnav svg, .sidenav svg { width: 24px; height: 24px; }

@media (min-width: 900px) {
  .bottomnav { display: none; }
  .app { display: grid; grid-template-columns: 232px 1fr; }
  .sidenav {
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--nav-bg); border-right: 1px solid rgba(255,255,255,.06); padding: 0 12px 16px;
  }
  .sidenav .brand { display: block; line-height: 60px; height: 60px; padding: 0 12px; margin-bottom: 10px; font-size: 1.3rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
  .sidenav .brand span { color: #6ea8ff; }
  .sidenav .brand:hover { background: none; text-decoration: none; }
  .sidenav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--nav-text); font-weight: 500; text-decoration: none; position: relative;
  }
  .sidenav a svg { color: var(--nav-muted); }
  .sidenav a:hover { background: rgba(255,255,255,.06); color: #fff; }
  .sidenav a.active { background: rgba(110,168,255,.16); color: #fff; font-weight: 600; }
  .sidenav a.active svg { color: #8ab4ff; }
  .sidenav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #6ea8ff; }
  .sidenav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 4px; }
  .sidenav .nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--nav-muted); padding: 6px 12px 4px; }
  .topbar .brand { display: none; }
  .topbar { padding: 0 24px; }
  .main { padding: 24px 28px 48px; }
}

/* ── Cabeçalho de página ─────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; margin-bottom: 8px; }

/* ── Cartões ─────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display:flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.stat .value.money { font-size: 1.15rem; }
a.stat:hover { border-color: var(--primary); }

/* ── Botões ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(.95); background: var(--green); }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); }
.btn-wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-wa:hover { background: #188a46; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0 22px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-block { width: 100%; white-space: normal; text-align: center; padding-top: 8px; padding-bottom: 8px; }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; min-height: 0; font-weight: 600; cursor: pointer; font: inherit; }
.btn-icon { width: 44px; padding: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px); z-index: 25; border-radius: 999px; box-shadow: 0 6px 16px rgba(31,111,235,.35); }
@media (min-width: 900px) { .fab { display: none; } }

/* ── Formulários ─────────────────────────────────────────── */
.field { margin-bottom: 14px; }
label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--input-border); border-radius: 10px;
  background: var(--input-bg); font: inherit; color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.grid { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .span-2 { grid-column: span 2; }
}
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.segmented label { margin: 0; padding: 10px 16px; cursor: pointer; font-weight: 600; }
.segmented input { position: absolute; opacity: 0; }
.segmented input:checked + span { color: var(--primary); }
.segmented label:has(input:checked) { background: var(--primary-soft); color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 699px) { .form-actions .btn { flex: 1; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters select { width: auto; flex: 0 1 auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .9rem; font-weight: 600; white-space: nowrap; text-decoration: none !important; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ── Itens (orçamento/OS) ────────────────────────────────── */
.items-editor .item-row { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--subtle); position: relative; }
.items-editor .item-row .grid { grid-template-columns: 1fr 1fr; gap: 0 10px; }
.items-editor .item-row .desc { grid-column: 1 / -1; }
@media (min-width: 800px) { .items-editor .item-row .grid { grid-template-columns: 3fr 1fr 1fr 1.3fr 1.2fr; } .items-editor .item-row .desc { grid-column: auto; } }
.items-editor .item-total { font-weight: 700; text-align: right; }
.items-editor .remove { position: absolute; top: 6px; right: 6px; }
.totals { margin-left: auto; max-width: 360px; }
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { font-size: 1.3rem; font-weight: 800; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; }

/* ── Listas / tabelas ────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--hover); }
.list-item .main-col { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { color: var(--muted); font-size: .86rem; }
.list-item .end { text-align: right; flex: none; }
.list-item .num { color: var(--muted); font-weight: 600; font-size: .86rem; }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table td.money, .table th.money { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.dl { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0; }
@media (min-width: 700px) { .dl { grid-template-columns: 1fr 1fr; } }
.dl dt { font-size: .8rem; color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 16px 0; }

/* ── Itens (visualização) ───────────────────────────────── */
.items-view { border-top: 1px solid var(--line); }
.iv-head { display: none; }
.iv-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.iv-desc { grid-column: 1 / -1; font-weight: 600; }
.iv-calc { color: var(--muted); font-size: .9rem; }
.iv-total { font-weight: 700; text-align: right; white-space: nowrap; }
@media (min-width: 700px) {
  .iv-head, .iv-row { display: grid; grid-template-columns: 1fr 220px 130px; gap: 12px; }
  .iv-head { padding: 8px 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); }
  .iv-desc { grid-column: auto; font-weight: 500; }
  .iv-calc { color: var(--text); font-size: 1rem; }
}

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--gray-soft); color: var(--gray); }

/* ── Alertas ─────────────────────────────────────────────── */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.flash-error { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.flash-warning { background: var(--orange-soft); color: var(--orange); border-color: var(--orange-line); }
.flash-info { background: var(--blue-soft); color: var(--primary-text); border-color: var(--blue-line); }
.banner { background: var(--yellow-soft); color: var(--yellow); padding: 8px 16px; font-size: .9rem; text-align: center; }
.banner a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ── Estados vazios / passos ─────────────────────────────── */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .icon { font-size: 2.4rem; margin-bottom: 6px; }
.empty h3 { color: var(--text); font-size: 1.1rem; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border: none; }
.steps .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--gray-soft); color: var(--muted); flex: none; }
.steps li.done .dot { background: var(--green); color: #fff; }
.steps li.done .txt { color: var(--muted); text-decoration: line-through; }
.steps .txt { flex: 1; }

/* ── Linha do tempo ──────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline .when { color: var(--muted); font-size: .8rem; }

/* ── Checklist ───────────────────────────────────────────── */
.checklist form { margin: 0; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check-item button.box { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--input-border); background: var(--surface); cursor: pointer; flex: none; font-size: 1rem; color: #fff; }
.check-item.done button.box { background: var(--green); border-color: var(--green); }
.check-item.done .lbl { text-decoration: line-through; color: var(--muted); }
.check-item .lbl { flex: 1; }

/* ── Agenda ──────────────────────────────────────────────── */
.week { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 1000px) { .week { grid-template-columns: repeat(7, 1fr); } }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 80px; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-bottom: 8px; }
.day-head a { font-weight: 600; font-size: .85rem; }
.event { display: block; padding: 8px 10px; border-radius: 8px; background: var(--primary-soft); border-left: 4px solid var(--primary); margin-bottom: 6px; color: var(--text); text-decoration: none !important; font-size: .88rem; }
.event .t { font-weight: 700; }
.event.conflict { background: var(--red-soft); border-left-color: var(--red); }
.event.st-done { opacity: .55; }

/* ── Autenticação ────────────────────────────────────────── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 420px; min-width: 0; }
.auth-box .brand { display: block; text-align: center; font-size: 2rem; margin-bottom: 6px; }
.auth-box .tag { text-align: center; color: var(--muted); margin-bottom: 20px; }

/* ── Documento (orçamento/OS para impressão e link público) ─ */
.doc { max-width: 820px; margin: 0 auto; background: #fff; color: var(--text); padding: 18px; border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: 16px; margin-bottom: 16px; }
.doc-head img { max-height: 70px; max-width: 200px; }
.doc-title { font-size: 1.4rem; font-weight: 800; }
.doc-meta { text-align: left; }
@media (min-width: 700px) { .doc { padding: 32px; } .doc-meta { text-align: right; } }
.doc-section { margin-bottom: 18px; }
.doc-section h3 { font-size: .8rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.doc-public { padding: 16px 12px 40px; }
.decision { border: 2px solid var(--primary); border-radius: var(--radius); padding: 18px; margin-top: 20px; background: var(--subtle); }
.disclaimer { font-size: .78rem; color: var(--muted); margin-top: 10px; }
.signature { margin-top: 48px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.signature div { border-top: 1px solid var(--text); padding-top: 6px; text-align: center; font-size: .85rem; }

@media print {
  body { background: #fff; }
  .no-print, .sidenav, .bottomnav, .topbar, .fab, .banner { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .doc { box-shadow: none; padding: 0; max-width: none; }
  a { color: inherit; }
}

/* ── Fotos, arquivos e assinatura ───────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-bottom: 12px; }
.thumb { margin: 0; min-width: 0; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; background: var(--gray-soft); }
.thumb figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; line-height: 1.25; }
.thumb-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--gray-soft); font-size: 1.8rem; text-align: center; padding: 6px; color: var(--text); }
.thumb-doc span { font-size: .72rem; word-break: break-all; line-height: 1.2; max-height: 3.6em; overflow: hidden; }
.upload-form { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; max-width: 100%; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; font-weight: 600; font-size: .9rem; cursor: pointer; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--primary); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.uploading { opacity: .6; pointer-events: none; }
.sig-pad { position: relative; border: 2px dashed #b8c0cc; border-radius: 10px; background: #fff; height: 190px; touch-action: none; }
.sig-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sig-line { position: absolute; left: 16px; right: 16px; bottom: 34px; border-top: 1px solid #d0d6de; color: #9aa3af; font-size: .75rem; padding-top: 2px; pointer-events: none; }
.sig-view { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sig-view img { max-width: 260px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.label-check-gap { margin-bottom: 10px; }
.print-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.print-photos figure { margin: 0; break-inside: avoid; }
.print-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }
.print-photos figcaption { font-size: .72rem; color: var(--muted); }
.sig-print img { max-height: 90px; max-width: 260px; display: block; margin: 0 auto -6px; }

/* ── Assinatura do SaaS ─────────────────────────────────── */
.banner-red { background: var(--red-soft); color: var(--red); }
.banner-blue { background: var(--blue-soft); color: var(--primary-text); }
.plans { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.plan.current { border: 2px solid var(--primary); }
.plan .price { font-size: 1.6rem; font-weight: 800; }
.plan .price small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.plan form { margin-top: auto; }
.qr { display: flex; justify-content: center; margin: 8px 0 14px; }
.qr svg { width: 240px; height: 240px; max-width: 100%; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; }


/* ── Navbar: busca de clientes ──────────────────────────── */
.nav-search { position: relative; flex: 1; min-width: 0; max-width: 560px; display: flex; align-items: center; }
.nav-search > svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--nav-muted); pointer-events: none; }
.nav-search input {
  width: 100%; min-height: 40px; padding: 8px 12px 8px 38px; border-radius: 10px;
  background: var(--nav-bg-2); border: 1px solid #334155; color: #fff; font-size: .95rem;
}
.nav-search input::placeholder { color: var(--nav-muted); }
.nav-search input:focus { outline: none; border-color: #6ea8ff; background: #243247; box-shadow: 0 0 0 3px rgba(110,168,255,.25); }
.nav-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.22); overflow: hidden; z-index: 60;
}
.nav-search-results a { display: flex; flex-direction: column; padding: 10px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.nav-search-results a:last-child { border-bottom: 0; }
.nav-search-results a small { color: var(--muted); }
.nav-search-results a.active, .nav-search-results a:hover { background: var(--primary-soft); }
.nav-search-results .empty-row { padding: 12px 14px; color: var(--muted); font-size: .9rem; }
@media (max-width: 520px) { .nav-search input { font-size: 16px; } .nav-search input::placeholder { font-size: .85rem; } }

/* ── Navbar: usuário + offcanvas ─────────────────────────── */
.avatar-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; border-radius: 12px; flex: none; margin-left: auto; }
.avatar-btn:hover, .avatar-btn:focus-visible { background: var(--nav-bg-2); outline: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex: none; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.05rem; }
.avatar-btn .who { display: none; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; max-width: 180px; }
.avatar-btn .who small { color: var(--nav-muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
@media (min-width: 700px) { .avatar-btn .who { display: flex; } }

.offcanvas-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 90; opacity: 0; transition: opacity .2s; }
.offcanvas-backdrop.show { opacity: 1; }
.offcanvas {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); z-index: 100;
  background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease; visibility: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
.offcanvas.open { transform: none; visibility: visible; }
.oc-head { display: flex; gap: 12px; align-items: center; padding: 20px 16px; border-bottom: 1px solid #1f2a3d; }
.oc-who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.oc-who strong { color: #fff; }
.oc-who small { color: var(--nav-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-close { background: none; border: 0; color: var(--nav-muted); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; flex: none; align-self: flex-start; }
.oc-close:hover { background: var(--nav-bg-2); color: #fff; }
.oc-close svg { width: 22px; height: 22px; }
.oc-links { padding: 10px 8px; flex: 1; overflow-y: auto; }
.oc-links a, .oc-links button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 10px;
  color: var(--nav-text); text-decoration: none; background: none; border: 0; font: inherit; font-weight: 500; cursor: pointer; text-align: left;
}
.oc-links a:hover, .oc-links button:hover { background: var(--nav-bg-2); color: #fff; text-decoration: none; }
.oc-links svg { width: 22px; height: 22px; color: var(--nav-muted); flex: none; }
.oc-links form { margin: 0; }
.oc-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nav-muted); padding: 14px 12px 4px; }
.oc-foot { padding: 12px 16px 20px; border-top: 1px solid #1f2a3d; margin: 0; }
.oc-foot .btn { background: var(--nav-bg-2); border-color: #334155; color: #fff; }
.oc-foot .btn:hover { background: #334155; }
body.oc-lock { overflow: hidden; }

/* ── Tema: seletor no menu do usuário ───────────────────── */
.oc-theme { padding: 0 16px 12px; margin: 0; }
.oc-theme .oc-label { padding: 6px 0 8px; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--nav-bg-2); padding: 4px; border-radius: 12px; }
.theme-switch button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 0; border-radius: 9px; background: none; color: var(--nav-muted); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; }
.theme-switch button svg { width: 20px; height: 20px; }
.theme-switch button:hover { color: #fff; }
.theme-switch button.on { background: #2b3a55; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }

/* ── Refinos de layout ──────────────────────────────────── */
body { -webkit-font-smoothing: antialiased; }
@media (min-width: 900px) { h1 { font-size: 1.65rem; } }
.card h2 { font-size: 1.08rem; font-weight: 700; }
.stat { position: relative; overflow: hidden; transition: border-color .15s, transform .15s; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--accent, var(--primary)); opacity: .85; }
.stats .stat:nth-child(1) { --accent: var(--orange); }
.stats .stat:nth-child(2) { --accent: var(--green); }
.stats .stat:nth-child(3) { --accent: var(--primary); }
.stats .stat:nth-child(4) { --accent: var(--purple); }
.stats .stat:nth-child(5) { --accent: var(--gray); }
.stats .stat:nth-child(6) { --accent: var(--green); }
a.stat:hover { transform: translateY(-1px); }
.bottomnav { box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.btn-primary { box-shadow: 0 1px 2px rgba(31,111,235,.25); }

/* ── Checklist: obrigatório, editor de modelos, horas ───── */
.req { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--red); background: var(--red-soft); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.rows-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.row-item { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); }
.row-item .row-btns { display: flex; gap: 6px; justify-content: flex-end; }
@media (min-width: 700px) { .row-item { grid-template-columns: 1fr 150px auto; align-items: center; } }
.time-total { font-size: 1.25rem; color: var(--primary-text); }

/* ── Marca OS Fácil XP ─────────────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none !important; line-height: 1; white-space: nowrap; }
.logo-mark { flex: none; border-radius: 22%; box-shadow: 0 2px 6px rgba(21,80,201,.35); }
.logo-text { font-weight: 600; font-size: 1.15rem; letter-spacing: -.02em; }
.logo-text b { font-weight: 800; }
.logo-dark .logo-text { color: #fff; }
.logo-dark .logo-text b { color: #fff; }
.logo-light .logo-text { color: var(--primary); }
.logo-light .logo-text b { color: var(--text); }
.brand-auth { display: flex; justify-content: center; margin-bottom: 8px; }
.brand-auth .logo-text { font-size: 1.9rem; }
@media (min-width: 900px) { .sidenav .logo.brand { display: flex; line-height: 60px; } }
@media (max-width: 899px) { .topbar .logo-text { display: none; } }
@media (min-width: 420px) and (max-width: 899px) { .topbar .logo-text { display: inline; font-size: 1rem; } }

/* ── Recebimentos / próximos passos ─────────────────────── */
.pay-bar { height: 10px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; margin: 4px 0 6px; }
.pay-bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.pay-sum { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.pay-sum strong { color: var(--text); }
.pay-form { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
details.void summary { cursor: pointer; color: var(--muted); }
.next-step { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 1px dashed var(--primary); background: var(--primary-soft); }
.equip-list .list-item .title { white-space: normal; }
.stats-2 { grid-template-columns: repeat(2, 1fr) !important; }
@media (min-width: 1000px) { .stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; max-width: 50%; } }
.stats .stat.stat-red { --accent: var(--red); }
.stats .stat.stat-green { --accent: var(--green); }
.logo-text .xp, .xp { font-style: normal; font-weight: 800; font-size: .58em; letter-spacing: .04em; background: #ffcd3c; color: #16181d; border-radius: 5px; padding: 2px 5px 1px; vertical-align: .32em; margin-left: 2px; }
