/* ============================================================
   ConsertaConnect — Estilo
   Paleta: azul-noite + ciano + verde WhatsApp
   ============================================================ */

:root {
  --bg:        #070d1a;
  --bg-2:      #0d1526;
  --surface:   #121c30;
  --surface-2: #18253d;
  --border:    #22314d;
  --text:      #e8eefc;
  --text-dim:  #8b9bb8;
  --primary:   #00d4ff;
  --primary-2: #0090ff;
  --accent:    #7c5cff;
  --whats:     #25d366;
  --success:   #22c55e;
  --warn:      #f59e0b;
  --danger:    #ef4444;

  --radius:    14px;
  --radius-lg: 22px;
  --shadow:    0 8px 32px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);

  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: .82rem; }

/* =======================  LOGIN  ======================= */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 212, 255, .12), transparent),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(124, 92, 255, .14), transparent),
    var(--bg);
}

.auth-bg-orbs { position: absolute; inset: 0; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .35;
  animation: float 16s ease-in-out infinite;
}
.orb-1 { width: 380px; height: 380px; background: var(--primary-2); top: -140px; left: -120px; }
.orb-2 { width: 320px; height: 320px; background: var(--accent); bottom: -130px; right: -90px; animation-delay: -6s; }
.orb-3 { width: 240px; height: 240px; background: var(--whats); top: 45%; left: 55%; opacity: .12; animation-delay: -11s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(30px, -40px) scale(1.08); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(160deg, rgba(24, 37, 61, .9), rgba(13, 21, 38, .96));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.4rem 2rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.auth-brand { text-align: center; margin-bottom: 2rem; }

.logo-mark {
  width: 72px; height: 72px;
  margin: 0 auto .9rem;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -.03em;
  color: #041022;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2) 55%, var(--accent));
  box-shadow: 0 10px 28px rgba(0, 144, 255, .45), inset 0 1px 0 rgba(255,255,255,.5);
}
.logo-sm { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 13px; margin: 0; flex: 0 0 auto; }

.brand-name {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, #fff, var(--primary) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-slogan { color: var(--text-dim); font-size: .92rem; margin-top: .15rem; }
.brand-meta {
  display: flex; align-items: center; justify-content: center;
  gap: .55rem; margin-top: .75rem;
  font-size: .74rem; color: var(--text-dim);
  font-family: var(--mono);
}
.dot { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-hint { text-align: center; font-size: .78rem; color: var(--text-dim); margin-top: .4rem; }
.auth-footer { margin-top: 1.8rem; font-size: .74rem; color: var(--text-dim); text-align: center; }

/* =======================  CAMPOS  ======================= */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .8rem; font-weight: 500; color: var(--text-dim); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="url"], input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%;
  padding: .72rem .9rem;
  background: rgba(7, 13, 26, .7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .92rem;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder, textarea::placeholder { color: #4e5f7d; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 212, 255, .05);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, .14);
}
textarea { resize: vertical; }

.input-with-btn { position: relative; display: flex; }
.input-with-btn input { padding-right: 2.8rem; }
.btn-ghost-sm {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  padding: .3rem .5rem; font-size: .9rem; color: var(--text-dim); border-radius: 8px;
}
.btn-ghost-sm:hover { background: rgba(255,255,255,.08); }

.check-inline { display: flex; align-items: flex-start; gap: .6rem; font-size: .85rem; color: var(--text-dim); margin-top: .8rem; }
.check-inline input { width: auto; margin-top: .22rem; accent-color: var(--primary); }

/* =======================  BOTÕES  ======================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .72rem 1.15rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .12s, box-shadow .2s, background .2s, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn-block { width: 100%; }
.btn-sm { padding: .48rem .8rem; font-size: .8rem; border-radius: 10px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #031324;
  box-shadow: 0 8px 22px rgba(0, 144, 255, .3);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(0, 212, 255, .42); }

.btn-outline { border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(0,212,255,.06); }

.btn-ghost { color: var(--text-dim); }
.btn-ghost:hover { background: rgba(255,255,255,.06); color: var(--text); }

.btn-whats { background: var(--whats); color: #07220f; box-shadow: 0 8px 22px rgba(37, 211, 102, .28); }
.btn-whats:hover { box-shadow: 0 10px 30px rgba(37, 211, 102, .45); }

.btn-danger { background: rgba(239, 68, 68, .14); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239, 68, 68, .22); }

/* =======================  MENSAGENS  ======================= */
.msg-box { font-size: .84rem; padding: 0; color: var(--text-dim); }
.msg-box.ok   { margin-top: .7rem; padding: .65rem .85rem; border-radius: 10px; background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.msg-box.err  { margin-top: .7rem; padding: .65rem .85rem; border-radius: 10px; background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.msg-box.info { margin-top: .7rem; padding: .65rem .85rem; border-radius: 10px; background: rgba(0,212,255,.10); color: #7dd3fc; border: 1px solid rgba(0,212,255,.25); }

/* =======================  APP SHELL  ======================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 258px;
  flex: 0 0 258px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1rem 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: transform .25s ease;
  z-index: 40;
}

.sidebar-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.8rem; padding: 0 .35rem; }
.sidebar-brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar-brand-txt strong { font-size: .98rem; font-weight: 700; }
.sidebar-brand-txt small { font-size: .7rem; color: var(--text-dim); letter-spacing: .08em; text-transform: uppercase; }

.nav-menu { display: flex; flex-direction: column; gap: .18rem; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .72rem .8rem;
  border-radius: 11px;
  font-size: .885rem;
  color: var(--text-dim);
  transition: background .16s, color .16s;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(0, 212, 255, .16), rgba(0, 212, 255, .03));
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary);
}
.nav-ico { font-size: 1.02rem; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: .95rem; display: flex; flex-direction: column; gap: .65rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.user-avatar {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 700; font-size: .9rem; color: #041022;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-info strong { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { font-size: .7rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-meta { display: flex; flex-direction: column; gap: .1rem; font-family: var(--mono); font-size: .64rem; color: #4e5f7d; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.05rem 1.6rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 21, 38, .78);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.page-title { font-size: 1.16rem; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; gap: .6rem; align-items: center; }

.btn-menu { display: none; font-size: 1.25rem; padding: .3rem .5rem; border-radius: 9px; }
.btn-menu:hover { background: rgba(255,255,255,.07); }

.view-container { padding: 1.6rem; }
.view { animation: fadeUp .28s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =======================  CARDS  ======================= */
.card {
  background: linear-gradient(165deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.15rem; flex-wrap: wrap;
}
.card-head h3 { font-size: 1.02rem; font-weight: 700; }

.section-title {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 1.9rem 0 .85rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.section-title:first-of-type { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }

.filters { display: flex; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 220px; }
.filters select { max-width: 230px; }
.input-sm { max-width: 300px; }

/* =======================  KPIs  ======================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.kpi {
  background: linear-gradient(160deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.2rem;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--k-color, var(--primary)), transparent);
  opacity: .8;
}
.kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1.2; margin-top: .25rem; font-family: var(--mono); }
.kpi-sub { font-size: .74rem; color: var(--text-dim); margin-top: .15rem; }

.stat-mini {
  background: rgba(7, 13, 26, .5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.stat-mini strong { font-size: 1.02rem; }
.stat-mini small { font-size: .72rem; color: var(--text-dim); }

/* =======================  TABELAS  ======================= */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
  text-align: left;
  padding: .55rem .7rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td { padding: .78rem .7rem; border-bottom: 1px solid rgba(34, 49, 77, .55); vertical-align: middle; }
.table tbody tr:hover { background: rgba(0, 212, 255, .04); }
.table .os-code { font-family: var(--mono); font-size: .8rem; color: var(--primary); font-weight: 600; }
.table .cliente-nome { font-weight: 600; }

.empty { text-align: center; padding: 2.4rem 1rem; color: var(--text-dim); display: flex; flex-direction: column; align-items: center; gap: .9rem; }

/* =======================  BADGES  ======================= */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .26rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-info { background: rgba(0,212,255,.12); color: var(--primary); }
.badge-ok { background: rgba(34,197,94,.14); color: #86efac; }
.badge-warn { background: rgba(245,158,11,.14); color: #fcd34d; }
.btn-danger { color: #fca5a5 !important; border-color: rgba(239,68,68,.45) !important; }
.btn-danger:hover { background: rgba(239,68,68,.14) !important; }

/* =======================  ESTOQUE  ======================= */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.estoque-qtd {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  text-align: center;
}
.acoes-estoque { display: flex; gap: .3rem; flex-wrap: wrap; }
.acoes-estoque .btn { padding: .28rem .5rem; font-size: .72rem; }
.msg-err { margin-top: .7rem; padding: .65rem .85rem; border-radius: 10px; background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }

/* =======================  PAINEL GRÁFICO  ======================= */
.rel-filtros {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  padding: 1rem 1.2rem;
}
.rel-filtro-item { display: flex; flex-direction: column; gap: .35rem; min-width: 180px; }
.rel-filtro-item label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.rel-filtros .btn { margin-left: auto; }

.rel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.rel-card { padding: 1.1rem 1.2rem 1.2rem; }
.rel-card-wide { grid-column: span 2; }
.chart-box {
  position: relative;
  width: 100%;
  height: 300px;
  margin-top: .6rem;
}
.chart-box-pie { height: 300px; }
.chart-box canvas { display: block; width: 100% !important; height: 100% !important; }

@media (max-width: 1000px) {
  .rel-grid { grid-template-columns: 1fr; }
  .rel-card-wide { grid-column: span 1; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .chart-box { height: 240px; }
  .rel-filtros .btn { margin-left: 0; width: 100%; }
  .kpi-value { font-size: 1.6rem; }
}

/* =======================  ATUALIZAÇÃO WHATSAPP  ======================= */
.wa-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.5;
  color: var(--text);
  background: rgba(37, 211, 102, .07);
  border: 1px solid rgba(37, 211, 102, .22);
  border-radius: 12px;
  padding: .8rem .9rem;
  margin: .6rem 0 0;
  max-height: 240px;
  overflow: auto;
}

/* =======================  CHECKLIST  ======================= */
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .5rem;
}
.chk-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .58rem .7rem;
  background: rgba(7, 13, 26, .5);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: .84rem;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.chk-item:hover { border-color: #2c4266; }
.chk-item input { width: auto; accent-color: var(--success); }
.chk-item:has(input:checked) { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.07); color: #bbf7d0; }

/* =======================  UPLOAD FOTOS  ======================= */
.foto-uploader { display: flex; flex-direction: column; gap: .85rem; }
.dropzone {
  display: flex; align-items: center; gap: .9rem;
  padding: 1.2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.dropzone:hover { border-color: var(--primary); background: rgba(0,212,255,.05); }
.dz-ico { font-size: 1.7rem; }
.dz-txt { font-size: .88rem; }

.fotos-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .65rem; }
.foto-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.foto-thumb .foto-del {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,.72); color: #fff; font-size: .72rem;
  display: grid; place-items: center;
}
.foto-thumb .foto-del:hover { background: var(--danger); }

/* =======================  TERMO  ======================= */
.termo-box {
  background: rgba(7, 13, 26, .6);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  font-size: .82rem;
  line-height: 1.65;
  color: #b6c5dd;
  white-space: pre-line;
  max-height: 230px;
  overflow-y: auto;
}
.termo-lg { max-height: none; font-size: .88rem; }

.termo-box p { margin: 0 0 .7rem; }
.termo-box p:last-child { margin-bottom: 0; }
.termo-box ul { margin: 0 0 .9rem; padding-left: 1.35rem; list-style: disc; }
.termo-box ul:last-child { margin-bottom: 0; }
.termo-box li { margin-bottom: .3rem; }
.termo-box li::marker { color: var(--primary); }
.termo-box strong { color: #e6eefc; font-weight: 700; }
.termo-box h4 {
  margin: .2rem 0 .6rem;
  font-size: .84rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
}

.form-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }

/* =======================  MODAL  ======================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 14, .78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
  z-index: 100;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 760px; max-height: 90vh;
  display: flex; flex-direction: column;
  background: linear-gradient(165deg, var(--surface-2), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fadeUp .22s ease;
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 1.02rem; font-family: var(--mono); color: var(--primary); }
.modal-close { font-size: 1.05rem; color: var(--text-dim); padding: .3rem .5rem; border-radius: 8px; }
.modal-close:hover { background: rgba(255,255,255,.08); color: var(--text); }
.modal-body { overflow-y: auto; padding: 1.3rem; }

/* Detalhe da OS dentro do modal */
.os-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.os-block {
  background: rgba(7, 13, 26, .55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.os-block h5 { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin-bottom: .45rem; }
.os-block p { font-size: .875rem; line-height: 1.5; }
.os-block strong { color: var(--text); }

.status-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .5rem; }
.status-pill {
  padding: .4rem .78rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all .15s;
}
.status-pill:hover { border-color: var(--primary); color: var(--text); }
.status-pill.active { color: #031324; font-weight: 700; border-color: transparent; }

.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .55rem; margin-top: .6rem; }
.fotos-grid img { border-radius: 10px; border: 1px solid var(--border); aspect-ratio: 1; object-fit: cover; cursor: pointer; }

.hist-list { display: flex; flex-direction: column; gap: .55rem; margin-top: .5rem; }
.hist-item { display: flex; gap: .7rem; font-size: .8rem; }
.hist-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .34rem; flex: 0 0 auto; }
.hist-txt { color: var(--text-dim); }
.hist-txt strong { color: var(--text); }

/* =======================  TOAST  ======================= */
.toast-container {
  position: fixed; bottom: 1.4rem; right: 1.4rem;
  display: flex; flex-direction: column; gap: .6rem;
  z-index: 200;
}
.toast {
  min-width: 240px; max-width: 360px;
  padding: .85rem 1rem;
  border-radius: 12px;
  font-size: .86rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slideIn .22s ease;
  display: flex; align-items: flex-start; gap: .55rem;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast.ok   { border-color: rgba(34,197,94,.45); color: #86efac; }
.toast.err  { border-color: rgba(239,68,68,.45); color: #fca5a5; }
.toast.info { border-color: rgba(0,212,255,.4); color: #7dd3fc; }
.toast.out { animation: slideOut .2s ease forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }

/* =======================  IMPRESSÃO TÉRMICA  ======================= */
.cupom-stage {
  display: flex;
  justify-content: center;
  padding: 1.2rem 0;
}

/* Cupom na tela: renderizado em preto sobre branco para simular o papel */
.cupom {
  background: #ffffff;
  color: #111111;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.42;
  padding: 8px 6px;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  width: 302px;              /* ~80 mm */
  max-width: 100%;
  overflow: hidden;
}
.cupom.largura-58 { width: 219px; font-size: 11px; }  /* ~58 mm */
.cupom * { box-sizing: border-box; }
.cupom p { margin: 0; }

.cupom .c-logo {
  display: block;
  max-height: 56px;
  max-width: 70%;
  margin: 0 auto 4px;
  object-fit: contain;
  filter: grayscale(1);
}
.cupom .c-linha { display: block; }
.cupom .c-center { text-align: center; }
.cupom .c-right { text-align: right; }
.cupom .c-bold { font-weight: 700; }
.cupom .c-big { font-size: 1.32em; font-weight: 700; letter-spacing: .5px; }
.cupom .c-xl { font-size: 1.7em; font-weight: 700; }
.cupom .c-small { font-size: .85em; }
.cupom .c-muted { color: #444; }

.cupom .c-sep {
  border-top: 1px dashed #333;
  margin: 5px 0;
}
.cupom .c-sep-solid {
  border-top: 1px solid #333;
  margin: 5px 0;
}
.cupom .c-kv { display: flex; justify-content: space-between; gap: 6px; }
.cupom .c-kv .c-k { font-weight: 700; }
.cupom .c-kv .c-v { text-align: right; word-break: break-word; }

.cupom .c-titulo {
  font-weight: 700;
  background: #111;
  color: #fff;
  text-align: center;
  padding: 1px 0;
  margin: 4px 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.cupom .c-termo {
  font-size: .8em;
  line-height: 1.28;
  white-space: pre-wrap;
  word-break: break-word;
  color: #222;
}

.cupom .c-assinatura {
  margin-top: 12px;
  border-top: 1px solid #333;
  padding-top: 2px;
  text-align: center;
  font-size: .85em;
}

.cupom-vazio { text-align: center; color: #777; padding: 2rem 0; }

/* ---- Regras de impressão ---- */
@media print {
  @page { margin: 3mm; }
  /* Só o cupom vai para o papel */
  body * { visibility: hidden !important; }
  #cupom, #cupom * { visibility: visible !important; }

  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
  }

  #cupom {
    position: absolute;
    left: 0;
    top: 0;
    display: block !important;
    width: 72mm !important;       /* 80 mm - margens */
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #cupom.largura-58 {
    width: 50mm !important;      /* 58 mm - margens */
    font-size: 10px !important;
  }

  .cupom .c-sep { border-top: 1px dashed #000; }
  .cupom .c-sep-solid { border-top: 1px solid #000; }
  .cupom .c-titulo { background: #000 !important; color: #fff !important; }
  .cupom .c-page-break { break-before: page; page-break-before: always; }
  .cupom .c-termo { font-size: .82em; }

  .no-print, .sidebar, .topbar, .toast-container, .modal-overlay { display: none !important; }
}

/* =======================  RESPONSIVO  ======================= */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .os-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .btn-menu { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .view-container { padding: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: .85rem 1rem; }
  .page-title { font-size: 1rem; }
  .kpi-value { font-size: 1.6rem; }
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { max-width: none; }
  .topbar-whats-txt { display: none; }
}

/* ==========================================================
   CATÁLOGO
   ========================================================== */
.card-head-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge-tipo {
  background: rgba(0, 212, 255, .14);
  color: var(--accent, #00d4ff);
  font-size: .72rem;
  font-weight: 600;
}

.cat-preco {
  font-weight: 700;
  white-space: nowrap;
}

/* Picker de serviços dentro da Nova OS */
.cat-picker {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .02);
}
.cat-picker > input[type="search"] {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: transparent;
  padding: .7rem .9rem;
  color: inherit;
  font-size: .9rem;
}
.cat-picker > input[type="search"]:focus {
  outline: none;
  background: rgba(0, 212, 255, .06);
}
.cat-picker-lista {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cat-opt {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .6rem;
  align-items: center;
  padding: .55rem .85rem;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: .86rem;
  transition: background .14s;
}
.cat-opt:hover { background: rgba(0, 212, 255, .08); }
.cat-opt.sel { background: rgba(37, 211, 102, .12); }
.cat-opt-nome { font-weight: 600; }
.cat-opt-meta { font-size: .74rem; opacity: .65; }
.cat-opt-add {
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .08);
  font-size: .8rem;
}
.cat-opt.sel .cat-opt-add {
  background: #25d366;
  color: #04121f;
}
.cat-opt-foot {
  padding: .6rem .85rem;
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex;
  justify-content: flex-end;
}

.cat-selecionados { margin-top: .75rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  background: rgba(0, 212, 255, .12);
  border: 1px solid rgba(0, 212, 255, .28);
  font-size: .8rem;
}
.cat-chip em { font-style: normal; opacity: .75; }
.cat-chip button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  opacity: .6;
  font-size: .8rem;
  padding: 0;
  line-height: 1;
}
.cat-chip button:hover { opacity: 1; color: #ef4444; }
.cat-total {
  margin-top: .6rem;
  font-size: .9rem;
  text-align: right;
  opacity: .9;
}
.cat-total strong { color: #25d366; }

/* Lista de serviços no modal da OS */
.os-serv-list {
  list-style: none;
  margin: .5rem 0 0;
  padding: 0;
}
.os-serv-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .42rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .1);
  font-size: .88rem;
}
.os-serv-list li:last-child { border-bottom: 0; }

/* Orçamento */
.orc-lista {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
}
.orc-lista li {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: .5rem;
  align-items: center;
  padding: .4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font-size: .88rem;
}
.orc-lista input {
  width: 100%;
  text-align: right;
}
.orc-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 2px solid rgba(255, 255, 255, .1);
  font-size: 1rem;
}
.orc-total strong {
  font-size: 1.35rem;
  color: #25d366;
}

