/* LIBERTAS 0.8.0 — identidade visual: azul-marinho com detalhes dourados. Cores e medidas ficam nas variáveis abaixo. */
:root {
  /* Azul-marinho como base */
  --bg: #0a1220;
  --bg-2: #0f1a2e;
  --surface: #14213a;
  --surface-2: #1b2b48;
  --line: #243653;
  --text: #eaf0fa;
  --muted: #8fa0ba;
  /* Azul de ação (botões, foco, links) */
  --accent: #4f8cff;
  --accent-strong: #3b78ee;
  --accent-soft: rgba(79, 140, 255, .14);
  /* Dourado discreto: marca, indicador do menu, números-chave */
  --gold: #c9a45c;
  --gold-strong: #e0be78;
  --gold-soft: rgba(201, 164, 92, .13);
  --gold-line: rgba(201, 164, 92, .38);
  --ok: #3ecf8e;
  --warn: #f0b24a;
  --warn-soft: rgba(240, 178, 74, .14);
  --danger: #ef6a6a;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 10px 28px rgba(2, 6, 14, .32);
  --font: "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", Roboto, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.012em; }
::selection { background: var(--gold-soft); color: #fff; }
/* rolagem discreta (só visual) */
* { scrollbar-width: thin; scrollbar-color: #2b3f60 transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.ic { display: block; flex: none; }

:focus-visible { outline: 2px solid var(--gold-strong); outline-offset: 2px; border-radius: 6px; }

/* ---------- Estrutura geral ---------- */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: 68px 1fr;
  grid-template-areas: "top top" "side main";
}
.topbar { grid-area: top; }
.sidebar { grid-area: side; }
.main { grid-area: main; min-height: 0; min-width: 0; overflow: auto; padding: 28px; }
.tabbar { display: none; }

/* ---------- Cabeçalho ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  background: linear-gradient(180deg, #0f1b31, var(--bg-2));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--gold-soft);
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #1d3258, #0c182d);
  color: var(--gold-strong);
  border: 1px solid var(--gold-line);
  box-shadow: 0 6px 16px rgba(2, 6, 14, .45), 0 0 0 3px var(--gold-soft);
}
.brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: .2em; font-size: 17px; }
.page-title { flex: 1; min-width: 0; padding-left: 18px; margin-left: 6px; border-left: 1px solid var(--line); color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title strong { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.role-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold-strong); border: 1px solid var(--gold-line);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.role-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.role-label { color: var(--muted); font-weight: 500; }

.icon-btn {
  position: relative;
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.badge-dot {
  position: absolute; top: 9px; right: 10px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg-2);
}
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #1f355c, #122240); border: 1px solid var(--gold-line);
  font-weight: 700; font-size: 14px; color: var(--gold-strong);
}
.user-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-text strong { font-size: 14px; }
.user-text small { color: var(--muted); font-size: 12px; }

.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 22px 48px rgba(2, 6, 14, .55);
  padding: 8px; z-index: 30;
  animation: pop .18s var(--ease);
}
.popover h3 { font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 10px; text-transform: uppercase; letter-spacing: .06em; }
.pop-item { display: flex; gap: 12px; padding: 10px; border-radius: var(--radius-sm); }
.pop-item:hover { background: var(--surface-2); }
.pop-item .ic { color: var(--gold); margin-top: 2px; }
.pop-item p { font-size: 14px; }
.pop-item small { color: var(--muted); }

/* ---------- Menu lateral ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), #0b1526);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  display: flex; flex-direction: column; gap: 4px;
  overflow: auto;
}
.side-label { color: #6f819c; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 14px 12px 6px; font-weight: 600; }
.side-label:first-child { padding-top: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 14px;
  position: relative;
  width: 100%; min-height: 46px; padding: 0 14px;
  background: transparent; border: 1px solid transparent; border-radius: 12px;
  color: var(--muted); text-align: left; font-weight: 600; font-size: 15px;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn .ic { transition: color .2s var(--ease); }
.nav-btn[aria-current="page"] { background: linear-gradient(90deg, var(--gold-soft), rgba(79, 140, 255, .06)); color: #fff; border-color: rgba(255, 255, 255, .05); }
.nav-btn[aria-current="page"] .ic { color: var(--gold-strong); }
.nav-btn[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.side-foot { margin-top: auto; padding: 12px 6px 2px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.side-user .avatar { width: 34px; height: 34px; font-size: 12px; }
.side-user strong { display: block; color: var(--text); font-size: 13px; line-height: 1.2; }
.side-user small { color: var(--muted); font-size: 11px; }
.side-ver { text-align: center; letter-spacing: .06em; color: #5f7290; }

/* ---------- Telas ---------- */
.screen { max-width: 980px; margin: 0 auto; animation: rise .35s var(--ease); }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.page-head .head-ic {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); border: 1px solid var(--gold-line);
}
.page-head h1 { font-size: 25px; letter-spacing: -.015em; }
.page-head p { color: var(--muted); font-size: 15px; margin-top: 2px; }

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: #c4d7ff; font-size: 14px;
  border: 1px solid rgba(79, 140, 255, .25);
  margin-bottom: 18px;
}
.notice .ic { margin-top: 1px; color: var(--accent); }
.notice.warn { background: var(--warn-soft); border-color: rgba(240, 178, 74, .3); color: #f5d9a3; }
.notice.warn .ic { color: var(--warn); }

.card {
  background: linear-gradient(180deg, #162540, var(--surface)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; margin-bottom: 14px; font-weight: 600; }

/* ---------- Início ---------- */
.hello h1 { font-size: 30px; letter-spacing: -.02em; }
.hello p { color: var(--muted); margin: 6px 0 24px; font-size: 17px; }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.module-card {
  text-align: left; display: flex; flex-direction: column; gap: 14px;
  min-height: 210px; padding: 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  transition: transform .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.module-card:hover { transform: translateY(-3px); border-color: rgba(79, 140, 255, .55); background: var(--surface-2); box-shadow: 0 14px 30px rgba(0, 0, 0, .28); }
.module-card .mod-ic {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.module-card h2 { font-size: 18px; letter-spacing: .02em; }
.module-card p { color: var(--muted); font-size: 15px; flex: 1; }
.module-card .go { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 22px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 16px;
  transition: background .2s var(--ease), transform .15s var(--ease), border-color .2s var(--ease), opacity .2s;
}
.btn:hover { background: #24344f; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .label { font-size: 14px; font-weight: 600; color: #c9d4e6; }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 0 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
textarea.input { padding: 12px 14px; min-height: 92px; resize: vertical; }
.input::placeholder { color: #5d6c85; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); font-weight: 600;
  transition: all .2s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: #d7e5ff; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 0; }

/* ---------- Status ---------- */
.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.draft { background: rgba(147, 161, 184, .14); color: var(--muted); }
.status.wait { background: var(--warn-soft); color: var(--warn); }

/* ---------- Suporte (chat) ---------- */
.chat-screen { height: 100%; display: flex; flex-direction: column; max-width: 860px; }
.chat-screen .chat { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.msgs { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 82%; animation: rise .3s var(--ease); }
.msg .bubble { padding: 12px 16px; border-radius: 16px; white-space: pre-wrap; }
.msg.bot .bubble { background: var(--surface-2); border-bottom-left-radius: 5px; }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.msg .tag { display: block; margin: 5px 4px 0; font-size: 12px; color: var(--muted); }
.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 12px; }
.chip {
  padding: 9px 14px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line);
  color: #c4d7ff; font-size: 14px; transition: all .2s var(--ease);
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--bg-2); }
.composer .input { flex: 1; }

/* ---------- Clientes ---------- */
.two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: start; }
.two-col .card + .card { margin-top: 0; }
.preview { position: sticky; top: 0; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.preview-head h2 { margin: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.kv dd.empty { color: #5d6c85; font-style: italic; }
.empty-box { text-align: center; color: var(--muted); padding: 28px 10px; }
.empty-box .ic { margin: 0 auto 10px; color: #4a5b78; }
.ai-line { display: flex; gap: 10px; align-items: center; color: #c4d7ff; font-size: 14px; margin-bottom: 14px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.missing { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: #f5d9a3; font-size: 14px; }

/* ---------- Ordens de serviço ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step {
  flex: 1; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: var(--bg-2); color: var(--muted); border: 1px solid var(--line); text-align: center;
}
.step.on { background: var(--accent-soft); color: #d7e5ff; border-color: var(--accent); }
.step.done { color: var(--ok); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 999px;
  background: var(--accent-soft); color: #d7e5ff; font-size: 15px; animation: rise .25s var(--ease);
}
.tag-chip button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: inherit; display: grid; place-items: center; }
.tag-chip button:hover { background: rgba(255, 255, 255, .18); }
.row-add { display: grid; grid-template-columns: 1fr 90px 140px auto; gap: 10px; align-items: end; margin-top: 14px; }
.row-add-staff { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.cat-group { margin-top: 18px; }
.cat-title { display: flex; justify-content: space-between; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cat-title span:last-child { color: var(--muted); font-weight: 600; }
.item-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--line); animation: rise .25s var(--ease); }
.item-row small { color: var(--muted); display: block; }
.item-row .val { font-weight: 600; }
.trash { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.trash:hover { background: rgba(239, 106, 106, .15); color: var(--danger); }
.no-items { color: var(--muted); padding: 18px 0 4px; text-align: center; font-size: 15px; }
.total-bar {
  position: sticky; bottom: -28px; margin: 18px -4px -4px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid rgba(79, 140, 255, .35);
  box-shadow: 0 -10px 24px rgba(14, 21, 34, .6);
}
.total-bar .sum small { display: block; color: var(--muted); font-size: 13px; }
.total-bar .sum strong { font-size: 26px; letter-spacing: -.01em; }
.review-block + .review-block { margin-top: 18px; }
.review-block h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; }
.sent-box { text-align: center; padding: 14px 6px 4px; }
.sent-box .big { width: 70px; height: 70px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); display: grid; place-items: center; margin: 0 auto 16px; }
.sent-box h2 { font-size: 22px; margin-bottom: 8px; }
.sent-box p { color: var(--muted); max-width: 460px; margin: 0 auto 16px; }

/* ---------- Ordens de serviço: abas, lista, serviços ---------- */
.status.ok { background: rgba(62, 207, 142, .14); color: var(--ok); }
.status.bad { background: rgba(239, 106, 106, .14); color: var(--danger); }
button.role-badge { border: 0; cursor: pointer; font-family: inherit; }
button.role-badge:hover { background: rgba(79, 140, 255, .24); }

.os-screen { min-height: 100%; display: flex; flex-direction: column; }
.os-screen .os-list { flex: 1; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; padding: 5px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
.tab {
  flex: 1; min-height: 48px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: #d7e5ff; box-shadow: inset 0 0 0 1px rgba(79, 140, 255, .45); }
.tab .count { min-width: 26px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 13px; }

.os-list { display: flex; flex-direction: column; gap: 10px; }
.os-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
  animation: rise .25s var(--ease);
}
.os-row:hover:not(:disabled) { border-color: rgba(79, 140, 255, .55); background: var(--surface-2); }
.os-row.selected { border-color: var(--accent); background: var(--accent-soft); }
.os-row:disabled { opacity: .55; cursor: not-allowed; }
.os-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.os-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-main small { color: var(--muted); font-size: 13px; }
.os-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.warnline { color: var(--warn) !important; }
.radio { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--muted); }
.radio.on { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 45%, transparent 50%); }

.action-bar { margin-top: 18px; justify-content: flex-end; }
.os-screen .action-bar { margin-top: auto; }
.os-screen .os-list { margin-bottom: 18px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title h2 { margin: 0; }
.readonly { min-height: 50px; display: flex; align-items: center; padding: 0 14px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); background: rgba(255, 255, 255, .02); }

.svc { padding: 18px; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); animation: rise .25s var(--ease); }
.svc:first-child { margin-top: 0; }
.svc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tchip {
  min-height: 42px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-weight: 600; transition: all .2s var(--ease);
}
.tchip:hover { color: var(--text); }
.tchip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: #d7e5ff; }
.cat-tag { display: inline-block; padding: 1px 9px; margin-right: 8px; border-radius: 999px; background: var(--accent-soft); color: #bcd2ff; font-size: 12px; font-weight: 600; }
.sum-line { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; margin-top: 4px; font-size: 18px; }
.sum-line strong { font-size: 22px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.history li { color: #c9d4e6; }
.history li span { color: var(--muted); margin-right: 6px; }
.field .error { margin-top: 0; min-height: 0; }
.svc-err { margin-top: 12px; }
@media (max-width: 760px) {
  .os-row { flex-wrap: wrap; }
  .os-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .action-bar .btn { flex: 1 1 auto; }
  .total-bar { padding: 12px 14px; gap: 10px; }
  .total-bar .btn-row { width: 100%; flex-wrap: nowrap; gap: 8px; }
  .total-bar .btn-row .btn { flex: 1 1 0; padding: 0 12px; }
  .total-bar .sum strong { font-size: 22px; }
  .tab { font-size: 15px; gap: 6px; }
}

/* ---------- Consulta automática (lupa) ---------- */
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }
.lookup-btn {
  flex: none; width: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--accent);
  display: grid; place-items: center; transition: background .2s var(--ease), border-color .2s var(--ease);
}
.lookup-btn:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.lookup-btn:disabled { opacity: .7; cursor: progress; }
.lookup-status { display: flex; align-items: center; gap: 8px; min-height: 0; font-size: 13px; color: var(--muted); margin-top: 2px; }
.lookup-status:empty { display: none; }
.lookup-status.ok { color: var(--ok); }
.lookup-status.warn { color: var(--warn); }
.lookup-status.error { color: var(--danger); }
input[data-autofilled] { border-color: rgba(62, 207, 142, .65); box-shadow: 0 0 0 2px rgba(62, 207, 142, .12); }
.modal.wide { max-width: 640px; max-height: 88vh; overflow: auto; }
.conf-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.conf-list { display: grid; gap: 8px; margin-top: 12px; }
.conf-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; }
.conf-row.conflict { border-color: rgba(240, 178, 74, .45); }
.conf-row input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.conf-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.conf-found { overflow-wrap: anywhere; }
.cat-tag.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Valores, descontos e conferência das ordens ---------- */
.btn.danger { color: #ffb4b4; border-color: rgba(239, 106, 106, .45); }
.btn.danger:hover { background: rgba(239, 106, 106, .16); }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; background: none; }
/* Aviso fixo de "sem conexão" (B13): sempre visível por cima de tudo enquanto o servidor não responde. */
.net-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 10px 16px; background: #5a1f1f; color: #ffe3e3; border-bottom: 2px solid #ef6a6a; font-size: 15px; text-align: center; }
.net-banner .btn { flex: none; }
.cli-diff { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 8px; overflow-wrap: anywhere; }
.cli-diff em { opacity: .6; }
.disc { color: #f19a9a; }
.disc-box { margin-top: 14px; display: grid; gap: 12px; }
.disc-fields { display: grid; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--line); }
.disc-fields[hidden] { display: none; }
.calc {
  display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; margin-top: 14px; padding: 12px 14px;
  border-radius: 12px; background: rgba(79, 140, 255, .08); border: 1px solid rgba(79, 140, 255, .25); font-size: 15px;
}
.calc.bad { background: rgba(239, 106, 106, .08); border-color: rgba(239, 106, 106, .35); }
.calc .final { margin-left: auto; font-size: 16px; }
.calc strong { font-variant-numeric: tabular-nums; }
.sum3 { display: flex; gap: 22px; flex-wrap: wrap; }
.sum3 small { display: block; color: var(--muted); font-size: 13px; }
.sum3 strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.sum3 .final strong { font-size: 24px; }
.svc-view { padding: 14px 0; border-bottom: 1px dashed var(--line); display: grid; gap: 4px; }
.svc-view:first-of-type { padding-top: 0; }
.svc-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.calc-line { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: baseline; font-size: 15px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.calc-line strong { margin-left: auto; font-size: 16px; }
.sum-card { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.sum-card > div { padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); display: grid; gap: 2px; }
.sum-card span { color: var(--muted); font-size: 13px; }
.sum-card strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.sum-card .final { background: var(--accent-soft); border-color: rgba(79, 140, 255, .45); }
.sum-card .final strong { font-size: 22px; }
@media (max-width: 760px) {
  .sum-card { grid-template-columns: 1fr; }
  .calc .final { margin-left: 0; }
  .calc-line strong { margin-left: 0; }
  .sum3 { gap: 14px; }
}

/* ---------- Telas de acesso (login, cadastro, recuperação, configuração) ---------- */
.app.auth-mode { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; grid-template-areas: "main"; }
.app.auth-mode .topbar, .app.auth-mode .sidebar, .app.auth-mode .tabbar { display: none; }
.app.auth-mode .main { padding: 16px; }
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 12px 0; animation: rise .35s var(--ease); }
.auth-card {
  width: 100%; max-width: 460px; padding: 30px 28px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; }
.auth-brand .brand-mark { width: 40px; height: 40px; }
.auth-brand .brand-name { font-weight: 700; letter-spacing: .16em; font-size: 18px; }
.auth-card h1 { font-size: 22px; text-align: center; letter-spacing: -.01em; }
.auth-sub { color: var(--muted); text-align: center; margin: 6px 0 18px; font-size: 15px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .btn.block { width: 100%; margin-top: 4px; }
.auth-card .error { margin: 0; }
.auth-card .error ul { margin: 6px 0 0; padding-left: 20px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 15px; margin: 18px 0 0; }
.auth-switch .link-btn { font-size: 15px; }
.auth-links.center { justify-content: center; margin-top: 8px; }
.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--accent); font-weight: 600; font-size: 15px; }
.link-btn:hover { text-decoration: underline; }
.code-box {
  margin: 14px 0; padding: 16px; text-align: center; border-radius: 12px; background: var(--bg-2);
  border: 1px dashed var(--accent); font-family: Consolas, "Courier New", monospace; font-size: 24px; letter-spacing: .12em; user-select: all;
}

/* ---------- Usuários (administrador) ---------- */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); animation: rise .25s var(--ease);
}
.user-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 240px; }
.user-main small, .muted { color: var(--muted); font-size: 13px; }
.user-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .user-side { align-items: flex-start; width: 100%; }
  .user-actions { justify-content: flex-start; }
  .auth-card { padding: 24px 18px; }
}

/* ---------- Janela, aviso rápido ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5, 9, 16, .66); z-index: 50;
  display: grid; place-items: start center; padding: 16px; animation: fade .2s var(--ease);
  overflow-y: auto; overscroll-behavior: contain;      /* janela mais alta que a tela rola, e nenhum botão fica fora do alcance */
}
.modal {
  width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px; box-shadow: 0 30px 60px rgba(0, 0, 0, .5); animation: pop .22s var(--ease);
  margin: auto;                                         /* centraliza quando cabe; alinha ao topo (e rola) quando não cabe */
}
.modal .sess-list { max-height: 45vh; overflow-y: auto; }
.modal .sess { padding: 10px 0; border-bottom: 1px solid var(--line); }
.modal .sess:last-child { border-bottom: 0; }   /* muitas sessões: a lista rola e os botões do rodapé continuam à vista */
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font-size: 20px; }
.modal p { color: var(--muted); }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: rise .25s var(--ease); font-size: 15px; }

/* ---------- Animações ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Celular e tablet ---------- */
@media (max-width: 900px) {
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: 0; flex-direction: row; align-items: center; gap: 16px; padding: 18px; }
  .module-card .text { flex: 1; }
  .module-card .go { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62px 1fr auto; grid-template-areas: "top" "main" "tab"; }
  .sidebar { display: none; }
  .main { padding: 16px; }
  .topbar { padding: 0 12px; }
  .brand-name { font-size: 16px; }
  .user-text { display: none; }
  .user-chip { padding-left: 0; }
  .role-label { display: none; }
  .tabbar {
    grid-area: tab; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    background: var(--bg-2); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tab-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 56px; border-radius: 12px; border: 0; background: transparent; color: var(--muted);
    font-size: 11px; font-weight: 600; transition: all .2s var(--ease);
  }
  .tab-btn[aria-current="page"] { color: #cfe0ff; background: var(--accent-soft); }
  .form-grid { grid-template-columns: 1fr; }
  .row-add { grid-template-columns: 1fr 1fr; }
  .row-add .field.desc { grid-column: 1 / -1; }
  .row-add .btn { grid-column: 1 / -1; }
  .row-add-staff { grid-template-columns: 1fr; }
  .total-bar { bottom: -16px; }
  .msg { max-width: 92%; }
  .hello h1 { font-size: 25px; }
  .kv { grid-template-columns: 100px 1fr; }
  .page-head .head-ic { width: 44px; height: 44px; }
  .page-head h1 { font-size: 20px; }
  .btn-row .btn { flex: 1 1 100%; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-right { gap: 4px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 14px; letter-spacing: .08em; }
  .role-badge { padding: 5px 9px; font-size: 12px; }
  .role-badge .dot { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  .badge-dot { top: 7px; right: 8px; }
  .avatar { width: 34px; height: 34px; font-size: 12px; }
}
@media (max-width: 420px) {
  .role-badge { padding: 5px 8px; font-size: 12px; }
  .steps .step { font-size: 12px; padding: 8px 4px; }
}

/* ---------- Criar OS com IA (conversa + prévia) e escolha IA/Manual ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.choice {
  display: grid; gap: 6px; text-align: left; padding: 18px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.choice:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.choice:disabled { opacity: .6; cursor: not-allowed; }
.choice strong { font-size: 17px; }
.choice small { color: var(--muted); font-size: 14px; }
.choice small.warnline { color: var(--warn); }
.choice-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.modal:has(.choice-grid) { max-width: 560px; }

.ai-tabs { display: none; }
.ai-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.ai-chat, .ai-preview { margin: 0; }
.ai-grid > .card + .card { margin-top: 0; }
.ai-log { display: flex; flex-direction: column; gap: 12px; max-height: min(58vh, 560px); min-height: 240px; overflow: auto; padding: 2px 4px 12px 0; }
.ai-msg { max-width: 92%; display: grid; gap: 4px; }
.ai-msg.user { align-self: flex-end; }
.ai-msg.sys { max-width: 100%; }
.ai-who { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-who .ic { color: var(--accent); }
.ai-bub { padding: 11px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 5px; overflow-wrap: anywhere; }
.ai-msg.user .ai-bub { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 14px; border-bottom-right-radius: 5px; }
.ai-bub.err { display: flex; gap: 10px; align-items: flex-start; background: rgba(239, 106, 106, .12); border-color: rgba(239, 106, 106, .4); color: #ffd0d0; }
.ai-bub.err .ic { flex: none; margin-top: 2px; }
.ai-notes { margin: 10px 0 0; padding: 10px 12px 10px 28px; border-radius: 10px; background: var(--warn-soft); color: #f5d9a3; font-size: 14px; }
.ai-typing { color: var(--muted); }
.ai-dots::after { content: "…"; animation: blink 1.2s infinite; }
.ai-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ai-form textarea { resize: vertical; min-height: 52px; max-height: 160px; }
.doc-banner { display: inline-block; margin-bottom: 14px; padding: 5px 12px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.doc-kv { margin-bottom: 10px; }
.doc-h { font-size: 15px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 14px 0 8px; }
.pend { color: var(--warn); font-style: italic; }
.ai-pending { margin-top: 14px; }
.ai-pending ul { margin: 6px 0 0; padding-left: 20px; }
.ai-actions { justify-content: flex-end; }
@media (max-width: 900px) {
  .ai-tabs { display: flex; }
  .ai-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-grid[data-pane="chat"] .ai-preview { display: none; }
  .ai-grid[data-pane="preview"] .ai-chat { display: none; }
  .ai-log { max-height: 52vh; }
}
@media (max-width: 520px) {
  .choice-grid { grid-template-columns: 1fr; }
  .ai-form { grid-template-columns: 1fr; }
  .ai-form .btn { width: 100%; }
  .ai-actions .btn { flex: 1 1 100%; }
  .sum-card { grid-template-columns: 1fr; }
}
.ai-foot { justify-content: flex-end; margin-top: 16px; }
.ai-tabs .count[hidden] { display: none; }
.ai-log { scrollbar-color: #3a4a66 transparent; }

/* ---------- CAPITALISTA MAX: identidade e tela de configuração ---------- */
.max-badge { background: linear-gradient(135deg, #4f8cff, #8b5cf6) !important; color: #fff !important; box-shadow: 0 6px 18px rgba(79, 140, 255, .35); }
.ai-msg:not(.user):not(.sys) .ai-bub { border-left: 3px solid var(--accent); }
.ai-who { letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }
.ai-who .ic { color: #8b5cf6; }
.ai-settings .check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.ai-settings .check input { width: 20px; height: 20px; accent-color: var(--accent); }
.test-steps { list-style: none; margin: 16px 0 6px; padding: 0; display: grid; gap: 8px; }
.test-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.test-steps li.ok .ic { color: var(--ok); }
.test-steps li.bad .ic { color: var(--danger); }
.ok-line { color: var(--ok); font-weight: 600; }
.ai-settings code { background: var(--bg-2); padding: 2px 8px; border-radius: 6px; }

/* ---------- Acesso pelo celular ---------- */
.pair-code { display: grid; gap: 4px; justify-items: center; padding: 18px; margin-top: 12px; border-radius: var(--radius); background: var(--bg-2); border: 1px dashed var(--accent); }
.pair-code strong { font-size: 40px; letter-spacing: .18em; font-variant-numeric: tabular-nums; color: #d7e5ff; }
.steps-list { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 6px; color: var(--muted); }
.dev-list { display: grid; gap: 10px; }
.dev-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.dev-row small { display: block; color: var(--muted); }

/* ---------- Aplicativo Android (WebView) ---------- */
html.is-android { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
html.is-android .main { overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
html.is-android .btn, html.is-android .tab-btn, html.is-android .nav-btn { touch-action: manipulation; }
html.is-android input, html.is-android textarea, html.is-android select { font-size: 16px; }

/* ---------- Finanças e Caderno ---------- */
.fin-row .os-side strong { font-size: 18px; }
.fin-sub { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cad-filters { margin-bottom: 16px; }
.cad-table { display: grid; gap: 6px; }
.cad-tr { display: grid; grid-template-columns: 1.4fr 1fr .6fr 1fr; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cad-tr span:nth-child(n+2), .cad-tr strong { text-align: right; }
.cad-th { background: transparent; border-color: transparent; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 520px) { .cad-tr { grid-template-columns: 1.2fr 1fr .5fr 1fr; padding: 9px 8px; font-size: 14px; } }
.sum-card > div:empty { display: none; }
@media (max-width: 480px) {
  .tab-btn { font-size: 10px; letter-spacing: -.02em; padding: 0 1px; min-width: 0; }
  .tab-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* =====================================================================
   0.8.0 — Painel (Dashboard) e navegação
   ===================================================================== */
.screen.dash { max-width: 1180px; }
.dash-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-hero h1 { font-size: 32px; letter-spacing: -.025em; line-height: 1.1; }
.dash-hero .eyebrow { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 8px; }
.dash-hero .sub { color: var(--muted); margin-top: 8px; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-h { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #7f92af; margin: 26px 0 12px; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi {
  position: relative; text-align: left; display: grid; gap: 4px; padding: 18px 18px 16px;
  background: linear-gradient(180deg, #162540, var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.kpi:hover { transform: translateY(-2px); border-color: rgba(201, 164, 92, .45); }
.kpi.gold::after { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 2px; border-radius: 0 0 2px 2px; background: linear-gradient(90deg, var(--gold), transparent); }
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); margin-bottom: 8px; }
.kpi-v { font-family: var(--font-display); font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi.gold .kpi-v { color: var(--gold-strong); }
.kpi-l { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-n { color: var(--warn); font-size: 12px; }

.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-grid.three { grid-template-columns: repeat(3, 1fr); }
.dash-card, .card.dash-card { margin: 0; min-width: 0; }
.dash-card + .dash-card { margin-top: 0; }
.dash-ch { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.dash-ch h2 { margin: 0; font-size: 16px; }
.link { background: none; border: 0; color: var(--gold-strong); font-weight: 600; font-size: 13px; padding: 4px 2px; }
.link:hover { text-decoration: underline; }
.count-pill { min-width: 26px; padding: 2px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-strong); font-size: 13px; font-weight: 700; text-align: center; }
.dash-empty { display: grid; justify-items: center; gap: 10px; padding: 22px 10px; text-align: center; color: var(--muted); }
.dash-empty .ic { color: #3d5173; }
.dash-empty p { max-width: 280px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }

.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; height: 150px; margin-bottom: 16px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar-fill { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--accent), #2a5bbd); min-height: 4px; transition: height .6s var(--ease); }
.bar-fill.zero { background: #22324e; }
.bar:last-child .bar-fill:not(.zero) { background: linear-gradient(180deg, var(--gold-strong), var(--gold)); }
.bar-n { font-size: 12px; color: var(--muted); min-height: 15px; font-variant-numeric: tabular-nums; }
.bar-l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.split { display: flex; height: 9px; border-radius: 999px; overflow: hidden; background: #1c2b45; gap: 2px; }
.split span { min-width: 6px; }
.seg-ok { background: var(--ok); } .seg-wait { background: var(--warn); } .seg-bad { background: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: #c7d3e6; }
.legend .muted { margin-left: auto; }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.lg.ok { background: var(--ok); } .lg.wait { background: var(--warn); } .lg.bad { background: var(--danger); }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px; background: transparent; border: 0; border-radius: 10px; transition: background .2s var(--ease); }
.feed-row:hover { background: rgba(255, 255, 255, .04); }
.feed-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.feed-dot.ok { background: var(--ok); } .feed-dot.wait { background: var(--warn); } .feed-dot.bad { background: var(--danger); }
.feed-tx { min-width: 0; flex: 1; }
.feed-tx strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-tx small { color: var(--muted); font-size: 12px; }
.tag-ia { padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold-strong); font-size: 11px; font-weight: 700; letter-spacing: .08em; }

.big { font-family: var(--font-display); font-size: 32px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.big.gold { color: var(--gold-strong); }
.rank { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.rank li { position: relative; display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding-bottom: 8px; }
.rank li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #c7d3e6; }
.rank li strong { font-variant-numeric: tabular-nums; }
.rank li i { position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--gold), transparent); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notes li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.notes li .ic { color: var(--gold); margin-top: 1px; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-tile { display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px; background: linear-gradient(180deg, #162540, var(--surface)); border: 1px solid var(--line); border-radius: 14px; transition: transform .2s var(--ease), border-color .2s var(--ease); min-width: 0; }
.quick-tile:hover { transform: translateY(-2px); border-color: var(--gold-line); }
.qt-ic { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); }
.qt-tx { min-width: 0; } .qt-tx strong { display: block; font-size: 14px; } .qt-tx small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.skel, .skel-lines { border-radius: var(--radius); background: linear-gradient(90deg, #14213a, #1b2b48, #14213a); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.kpi.skel { height: 124px; border: 1px solid var(--line); }
.skel-lines { height: 150px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Navegação do celular: barra inferior + folha "Mais" ---------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(4, 8, 16, .6); display: flex; align-items: flex-end; animation: fade .2s var(--ease); }
.sheet { width: 100%; background: var(--surface); border-top: 1px solid var(--gold-line); border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: rise .25s var(--ease); }
.sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: #314668; margin: 4px auto 16px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.sheet-item { display: grid; justify-items: center; gap: 8px; padding: 16px 6px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600; }
.sheet-item .ic { color: var(--gold-strong); }
.sheet-close { width: 100%; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .dash-grid.three { grid-template-columns: 1fr 1fr; }
  .dash-grid.three > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .dash-grid, .dash-grid.three { grid-template-columns: 1fr; }
  .dash-grid.three > :last-child { grid-column: auto; }
  .page-title { display: none; }
}
@media (max-width: 760px) {
  .dash-hero h1 { font-size: 26px; }
  .dash-actions { width: 100%; } .dash-actions .btn { flex: 1; }
  .tabbar { grid-template-columns: repeat(5, 1fr) !important; background: linear-gradient(180deg, #0f1a2e, #0a1220); border-top: 1px solid var(--gold-soft); }
  .tab-btn { font-size: 11px !important; letter-spacing: 0 !important; }
  .tab-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-btn[aria-current="page"] { color: var(--gold-strong) !important; background: var(--gold-soft) !important; }
  .main { padding: 16px 14px 20px; }
}
@media (max-width: 480px) {
  .kpis { gap: 10px; } .kpi { padding: 14px 14px 12px; } .kpi-v { font-size: 28px; }
  .quick { grid-template-columns: 1fr; }
  .bars { gap: 8px; }
}

/* =====================================================================
   0.8.0 — Clientes
   ===================================================================== */
.cli-screen { max-width: 1080px; }
.cli-head { align-items: center; }
.cli-head-tx { flex: 1; min-width: 0; }
.cli-new-btn, .cli-head .cli-new { margin-left: auto; }
.cli-tools { display: grid; grid-template-columns: 1fr 230px; gap: 12px; margin-bottom: 12px; }
.cli-search { position: relative; }
.cli-search .input { padding-left: 44px; padding-right: 44px; }
.cli-search-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.cli-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.cli-clear:hover { background: var(--surface-2); color: var(--text); }
.cli-search .input::-webkit-search-cancel-button { display: none; }
.cli-sort .input { cursor: pointer; }
.cli-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip-n { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 12px; }
.cli-count { min-height: 20px; font-size: 13px; margin: 4px 2px 8px; }

.cli-list { display: grid; gap: 10px; }
.cli-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; background: linear-gradient(180deg, #162540, var(--surface)); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); transition: transform .2s var(--ease), border-color .2s var(--ease); }
.cli-row:hover { transform: translateY(-1px); border-color: var(--gold-line); }
.cli-av { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(150deg, #1f355c, #122240); border: 1px solid var(--gold-line); color: var(--gold-strong); font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.cli-av.big { width: 64px; height: 64px; font-size: 22px; }
.cli-tx { min-width: 0; flex: 1; display: grid; gap: 2px; }
.cli-tx strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cli-tx small { color: var(--muted); font-size: 13px; }
.cli-badge { font-size: 12px; padding: 4px 10px; }
.cli-go { color: var(--muted); }
.cli-row:hover .cli-go { color: var(--gold-strong); }
.cli-empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.cli-empty .ic { color: #3d5173; }
.cli-empty h2 { color: var(--text); font-size: 18px; margin: 4px 0 0; }
.cli-empty p { max-width: 380px; font-size: 14px; }
.cli-skel { display: grid; gap: 10px; }
.cli-skel .skel { height: 72px; }

.cli-hero { display: flex; align-items: center; gap: 16px; margin: 16px 0 18px; }
.cli-hero-tx { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.cli-hero-tx h1 { font-size: 28px; overflow-wrap: anywhere; }
.cli-kpis { margin-bottom: 16px; }
.kpi-money { font-size: 24px; }
.cli-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.cli-cols > div > .card + .card { margin-top: 16px; }
.cli-note { margin: 14px 0 0; }
.cli-os { display: grid; gap: 8px; }
.cli-os-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.cli-os-main { display: grid; gap: 2px; min-width: 0; } .cli-os-main small { color: var(--muted); font-size: 12px; }
.cli-os-side { display: grid; gap: 6px; justify-items: end; font-variant-numeric: tabular-nums; }
.cli-os-side .status { font-size: 12px; padding: 3px 10px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; display: grid; gap: 14px; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding-left: 18px; font-size: 14px; }
.tl-dot { position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.timeline small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* formulário em grupos */
.cli-newform { align-items: start; }
.cli-group + .cli-group, .cli-group + .cli-form-actions { margin-top: 16px; }
.cli-group h2 { display: flex; align-items: center; gap: 10px; }
.cli-g-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); }
.cli-preview { position: sticky; top: 0; }
.req, .rec, .opt { margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; letter-spacing: .02em; }
.req { background: rgba(239, 106, 106, .14); color: #ffb4b4; }
.rec { background: var(--gold-soft); color: var(--gold-strong); }
.opt { background: rgba(147, 161, 184, .12); color: var(--muted); }
.field-err { color: var(--danger) !important; min-height: 0; }
.field.has-err .input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 106, 106, .12); }

@media (max-width: 900px) {
  .cli-cols { grid-template-columns: 1fr; }
  .cli-preview { position: static; }
}
@media (max-width: 760px) {
  .cli-tools { grid-template-columns: 1fr; }
  .cli-head { flex-wrap: wrap; }
  .cli-head .cli-new { margin-left: 0; width: 100%; }
  .cli-hero-tx h1 { font-size: 22px; }
  .cli-av.big { width: 54px; height: 54px; font-size: 19px; }
  .cli-chips { flex-wrap: nowrap; overflow-x: auto; margin-right: -14px; padding-right: 14px; padding-bottom: 4px; scrollbar-width: none; }
  .cli-chips .tchip { flex: none; }
  .cli-row { padding: 12px; gap: 12px; }
  .cli-badge { display: none; }
  .cli-form-actions .btn { width: 100%; }
}
