/* Base visual copiada do TI SG-OS (styles.css). Azul royal + laranja, tema claro/escuro. */
:root {
  --royal: #2547d0;
  --royal-escuro: #1a338f;
  --royal-suave: #e6ecfd;
  --laranja: #f97316;
  --laranja-hover: #ea580c;
  --laranja-suave: #fff1e6;

  --bg: #f2f5fb;
  --card: #ffffff;
  --card-2: #f7f9fe;
  --text: #0f172a;
  --muted: #5b6478;
  --border: #dfe5f1;
  --input-border: #c6cfe2;
  --hover: #f0f4fd;
  --primary: var(--royal-escuro);
  --primary-text: #dbe4ff;
  --primary-hover: #2a46b8;
  --accent: var(--laranja);
  --link: var(--royal);
  --focus: rgba(249, 115, 22, 0.35);
  --danger: #dc2626;
  --danger-border: #fecaca;
  --alerta-bg: #fff4e5;
  --alerta-text: #7c3a06;
  --alerta-border: #fdba74;
  --sombra: 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius: 10px;
  --nav-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) {
    --royal: #7c9cff;
    --royal-suave: #1c2a55;
    --laranja-suave: #3a2213;
    --bg: #0b1020;
    --card: #131a2e;
    --card-2: #182240;
    --text: #e5e9f5;
    --muted: #96a0b8;
    --border: #253256;
    --input-border: #33426b;
    --hover: #1b2643;
    --primary: #0e1736;
    --primary-text: #b9c6ef;
    --primary-hover: #1d2c5e;
    --link: #8ea8ff;
    --danger: #f87171;
    --danger-border: #7f1d1d;
    --alerta-bg: #3a2310;
    --alerta-text: #fed7aa;
    --alerta-border: #9a4a0f;
    color-scheme: dark;
  }
}
:root[data-theme='escuro'] {
  --royal: #7c9cff;
  --royal-suave: #1c2a55;
  --laranja-suave: #3a2213;
  --bg: #0b1020;
  --card: #131a2e;
  --card-2: #182240;
  --text: #e5e9f5;
  --muted: #96a0b8;
  --border: #253256;
  --input-border: #33426b;
  --hover: #1b2643;
  --primary: #0e1736;
  --primary-text: #b9c6ef;
  --primary-hover: #1d2c5e;
  --link: #8ea8ff;
  --danger: #f87171;
  --danger-border: #7f1d1d;
  --alerta-bg: #3a2310;
  --alerta-text: #fed7aa;
  --alerta-border: #9a4a0f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: 0.95rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--primary); color: var(--primary-text); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
  border-right: 3px solid var(--laranja);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 4px 8px 18px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; }
.brand img.app-logo { background: transparent; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: var(--primary-text); padding: 10px 12px; border-radius: 8px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--primary-hover); color: #fff; }
.nav a.active { background: var(--primary-hover); color: #fff; border-left-color: var(--laranja); }
.nav .ico { width: 20px; text-align: center; }
.sidebar .user { margin-top: auto; font-size: 0.85rem; padding: 8px; border-top: 1px solid var(--primary-hover); }
.sidebar .user button { margin-top: 8px; width: 100%; }
.main { flex: 1; min-width: 0; padding: 20px 24px 40px; max-width: 1200px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.bottom-nav { display: none; }
.mobile-header { display: none; }
.alerta { background: var(--alerta-bg); color: var(--alerta-text); border: 1px solid var(--alerta-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.alerta a { color: inherit; font-weight: 600; text-decoration: underline; }
.previa { display: flex; gap: 14px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: #fff; color: #0f172a; }
.previa img, .previa .sem-logo { width: 90px; height: 60px; object-fit: contain; flex-shrink: 0; }
.previa .sem-logo { display: flex; align-items: center; justify-content: center; border: 1px dashed #cbd5e1; border-radius: 6px; color: #64748b; font-size: 0.75rem; }
.previa .muted { color: #64748b; }
.previa-txt { flex: 1; min-width: 0; }
.previa-nome { font-weight: 700; font-size: 1.1rem; }
.previa-os { text-align: right; white-space: nowrap; }
@media (max-width: 600px) { .previa { flex-wrap: wrap; } .previa-os { width: 100%; text-align: left; } }

@media (max-width: 820px) {
  .sidebar { display: none; }
  .layout { flex-direction: column; }
  .mobile-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--primary); color: #fff;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px; position: sticky; top: 0; z-index: 20;
    border-bottom: 3px solid var(--laranja);
  }
  .mobile-header .brand { padding: 0; font-size: 0.95rem; min-width: 0; }
  .mobile-header .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-header .brand img { width: 28px; height: 28px; }
  .mobile-header button { color: var(--primary-text); }
  .main { padding: 14px 12px calc(var(--nav-h) + 24px); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--primary); z-index: 20;
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--primary-text); opacity: 0.75; font-size: 0.68rem; gap: 2px; border-top: 3px solid transparent;
  }
  .bottom-nav a .ico { font-size: 1.2rem; }
  .bottom-nav a.active { color: #fff; opacity: 1; border-top-color: var(--laranja); }
}

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } }
/* PDV: carrinho e pagamento com mais espaco */
.cols.pdv { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
@media (max-width: 1000px) { .cols.pdv { grid-template-columns: minmax(0, 1fr); } }

label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: 9px 11px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--card);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); border-color: var(--laranja); }
input[type='checkbox'] { width: auto; accent-color: var(--laranja); }
.field { margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 140px; }

button, .btn {
  font: inherit; border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 9px 14px;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--hover); }
button.primary, .btn.primary { background: var(--laranja); border-color: var(--laranja); color: var(--laranja-texto, #fff); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--laranja-hover); border-color: var(--laranja-hover); }
button.dark { background: var(--royal); border-color: var(--royal); color: #fff; }
button.dark:hover { filter: brightness(1.1); background: var(--royal); }
button.danger, .btn.danger { color: var(--danger); border-color: var(--danger-border); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--hover); }
.mobile-header button.ghost:hover { background: var(--primary-hover); }
button.sm { padding: 5px 9px; font-size: 0.85rem; }
button:disabled { opacity: 0.55; cursor: default; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
  background: var(--hover); color: var(--muted);
}
.pr-alta { background: #fed7aa; color: #9a3412; }
.pr-urgente { background: #fecaca; color: #991b1b; }

.status-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.status-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; box-shadow: var(--sombra); }
.status-card .n { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.os-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; cursor: pointer; color: inherit;
  box-shadow: var(--sombra);
}
.os-item:hover { border-color: var(--royal); }
.os-item .num { font-weight: 700; font-size: 1.05rem; color: var(--royal); }
.os-item .tit { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item .sub { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item .side { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { flex: 1; min-width: 180px; }
.filters select { width: auto; }

table.items { width: 100%; border-collapse: collapse; }
table.items th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.items td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.items input, table.items select { padding: 6px 8px; }
table.items .q { width: 70px; }
table.items .v { width: 110px; }
table.items .d { width: 150px; }
table.items .t { width: 100px; text-align: right; white-space: nowrap; }
@media (max-width: 820px) {
  table.items thead { display: none; }
  table.items tr { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  table.items td { border: 0; padding: 0; }
  table.items td.desc, table.items td.d { grid-column: 1 / -1; }
  table.items .q, table.items .v, table.items .d { width: auto; }
}
.totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 10px; }
.totals .grand { font-size: 1.2rem; font-weight: 700; color: var(--royal); }
.tipo { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }

.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.fotos .foto { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--hover); }
.fotos img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.fotos .del { position: absolute; top: 4px; right: 4px; padding: 2px 7px; background: rgba(255, 255, 255, 0.9); color: #0f172a; }

.hist { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.hist .quando { color: var(--muted); font-size: 0.78rem; }

.assinatura-img { max-width: 100%; max-height: 120px; border: 1px dashed var(--border); border-radius: 8px; background: #fff; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 12, 30, 0.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: var(--card); color: var(--text); border-radius: 12px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 18px; border: 1px solid var(--border); }
.modal.wide { max-width: 860px; }
/* Visualizacao do PDF (so computador) */
.modal-pdf .modal { max-width: 980px; height: 94vh; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-pdf .modal-head { flex-wrap: wrap; gap: 8px; }
.pdf-preview { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #525659; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pick { display: flex; justify-content: space-between; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick:hover { background: var(--hover); }
canvas.sign { width: 100%; height: 220px; border: 1px dashed #94a3b8; border-radius: 8px; touch-action: none; background: #fff; }
.viewer img { max-width: 100%; max-height: 80vh; display: block; margin: auto; }

/* ---------- Login ---------- */
.center-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(160deg, var(--royal-escuro) 0%, var(--royal-escuro) 45%, var(--bg) 45%);
}
.login-card { width: 100%; max-width: 380px; border-top: 4px solid var(--laranja); }
.login-card .logo { text-align: center; margin-bottom: 16px; }
.login-card .logo img { max-height: 72px; max-width: 200px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%); background: var(--royal-escuro); color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 100; max-width: 90vw; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  border-left: 4px solid var(--laranja);
}
.toast.erro { background: #b91c1c; border-left-color: #fecaca; }
.toast:not([hidden]) { display: flex; align-items: center; gap: 12px; }
.toast-x {
  background: transparent; border: 0; color: #fff; font-size: 16px; line-height: 1; padding: 2px 4px; margin: -2px -6px -2px 0;
  cursor: pointer; opacity: 0.85; min-height: 0; box-shadow: none;
}
.toast-x:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.qr { display: flex; gap: 20px; flex-wrap: wrap; }
.qr div { text-align: center; }
.qr img { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 8px; }
.fab {
  display: none; position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px); width: 56px; height: 56px; border-radius: 50%;
  font-size: 1.7rem; z-index: 21; box-shadow: 0 6px 16px var(--focus);
}
@media (max-width: 820px) { .fab { display: inline-flex; } .hide-mobile { display: none !important; } }
.equip.varios { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--card-2); }
.equip-cliente { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.vinculo { margin: -2px 0 8px; color: var(--muted); }
.pag-linha { margin: 6px 0; }
.paleta { display: inline-flex; align-items: center; gap: 4px; }
.bolinha { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.15); }
#pag-soma { margin-top: 4px; }

/* Relatorios */
.barras { display: flex; align-items: flex-end; gap: 3px; height: 160px; overflow-x: auto; padding-top: 6px; }
.barra { flex: 1; min-width: 18px; max-width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.barra-v { width: 100%; background: var(--royal); border-radius: 3px 3px 0 0; opacity: 0.85; }
.barra.pico .barra-v { background: var(--laranja); opacity: 1; }
.barra:hover .barra-v { opacity: 1; }
.barra.zero { border-bottom: 2px solid var(--border); }
.barras { border-bottom: 1px solid var(--border); }
.graf-topo { display: flex; justify-content: space-between; margin-bottom: 4px; }
.barra-l { font-size: 0.62rem; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.rel-status { padding: 6px 0; cursor: pointer; }
.rel-status:hover { background: var(--hover); }
.trilho { height: 6px; background: var(--hover); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.trilho div { height: 100%; border-radius: 3px; }
table.rel td, table.rel th { font-size: 0.88rem; }
@media (max-width: 820px) {
  table.rel thead { display: table-header-group; }
  table.rel tr { display: table-row; }
  table.rel td { padding: 5px 4px; border-bottom: 1px solid var(--border); }
}

/* Orcamentos */
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 6px 0; font-weight: 500; color: var(--text); font-size: 0.9rem; }
.tema-btn { font-size: 1rem; }
@media (min-width: 821px) { table.items td.desc { min-width: 220px; } }
input[readonly] { background: var(--hover); color: var(--text); cursor: default; }
table.items input[readonly] { border-color: transparent; font-weight: 600; }
.rodape-acoes { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.rodape-acoes .primary { min-width: 160px; }
@media (max-width: 820px) { .rodape-acoes .primary { flex: 1; } }
.aviso-instalar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--royal-suave); border: 1px solid var(--royal); border-left: 4px solid var(--laranja);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.9rem;
}
/* Zona de perigo */
.zona-perigo { border-color: var(--danger-border); border-left: 4px solid var(--danger); }
/* Parte de Config. travada pelo master: fieldset sem moldura. */
fieldset.trava { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.trava[disabled] { opacity: .55; }
.alerta-perigo { background: rgba(220, 38, 38, 0.08); border: 1px solid var(--danger-border); color: var(--text); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
button.danger-cheio { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 600; }
button.danger-cheio:hover { background: #b91c1c; }
/* Retirada (interno) */
.badge-retirada { background: rgba(180, 83, 9, 0.12); color: #b45309; border: 1px dashed #b45309; }
.badge-retirado { background: rgba(21, 128, 61, 0.1); color: #15803d; border: 1px dashed #15803d; }
:root[data-theme='escuro'] .badge-retirada { color: #fdba74; border-color: #fdba74; }
:root[data-theme='escuro'] .badge-retirado { color: #86efac; border-color: #86efac; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) .badge-retirada { color: #fdba74; border-color: #fdba74; }
  :root:not([data-theme='claro']) .badge-retirado { color: #86efac; border-color: #86efac; }
}
.retirada-campo select { border-style: dashed; }
.sidebar .versao { margin-top: 10px; font-size: 0.72rem; opacity: 0.6; text-align: center; letter-spacing: 0.02em; }
/* Pagamento pendente */
.badge-pendente { background: rgba(15, 118, 110, 0.1); color: #0f766e; border: 1px dashed #0f766e; }
.badge-vencido { background: rgba(185, 28, 28, 0.1); color: #b91c1c; border: 1px solid #b91c1c; }
:root[data-theme='escuro'] .badge-pendente { color: #5eead4; border-color: #5eead4; }
:root[data-theme='escuro'] .badge-vencido { color: #fca5a5; border-color: #fca5a5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) .badge-pendente { color: #5eead4; border-color: #5eead4; }
  :root:not([data-theme='claro']) .badge-vencido { color: #fca5a5; border-color: #fca5a5; }
}
/* Leitor de codigo pela camera */
.cam-box { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
.cam-box video { display: block; width: 100%; max-height: 60vh; object-fit: cover; }
.cam-mira { position: absolute; left: 10%; right: 10%; top: 35%; bottom: 35%; border: 2px solid #f97316; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25); pointer-events: none; }
/* Usuarios > Perfis de acesso */
.tabela-perfis { overflow-x: auto; }
table.perfis th.center, table.perfis td.center { text-align: center; }
table.perfis tr.grupo td { background: var(--card-2); font-weight: 700; color: var(--royal); }
table.perfis input[type='checkbox'] { width: 18px; height: 18px; }
/* Desbloqueio do aparelho: grade para desenhar o padrao */
.padrao-box { width: 200px; height: 200px; margin: 4px auto; background: var(--card-2); border: 1px solid var(--border); border-radius: 14px; touch-action: none; user-select: none; cursor: crosshair; }
.padrao-box svg { display: block; }
/* Checklist de entrada */
.chk-item { border-style: dashed; }
.chk-item.sim { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.chk-item.nao { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
/* Agenda */
.agenda { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ag-cab { text-align: center; font-size: 0.75rem; color: var(--muted); font-weight: 700; padding: 2px 0; }
.ag-dia { min-height: 86px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--card); overflow: hidden; }
.ag-dia.vazio { background: transparent; border-style: dashed; opacity: 0.4; }
.ag-dia.hoje { border: 2px solid var(--laranja); }
.ag-num { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.ag-os { display: block; font-size: 0.72rem; padding: 1px 4px; margin-top: 2px; background: var(--card-2); border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
@media (max-width: 700px) { .ag-dia { min-height: 64px; } .ag-os { font-size: 0.62rem; } }
/* Registro de acoes */
table.acoes td, table.acoes th { text-align: left !important; vertical-align: top; }
tr.alerta-linha td { background: rgba(220, 38, 38, 0.07); }
/* Cadastro de produto: custo, margens e precos */
.precos { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; background: var(--card-2); }
.precos-linha { display: grid; grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; }
.precos-linha .field { margin-bottom: 6px; }

/* ---------- Icones (icones.js) ---------- */
.tic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.nav a > .ico, .bottom-nav a > .ico {
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: #475569; flex: none; font-size: 1rem;
}
.nav a > .ico .tic { width: 18px; height: 18px; vertical-align: 0; }
.nav a.active > .ico { box-shadow: 0 0 0 2px #fff; }
.nav .nav-sub a > .ico { width: 18px; height: 18px; background: none; box-shadow: none; }
.nav .nav-sub a > .ico .tic { width: 15px; height: 15px; }
.bottom-nav a > .ico { width: 28px; height: 28px; }
.bottom-nav a > .ico .tic { width: 17px; height: 17px; vertical-align: 0; }
.bottom-nav a.active > .ico { box-shadow: 0 0 0 2px #fff; }
.nav a[data-sub="relatorios"] > .ico { background: #db2777; }

/* Cor do quadrado de cada item do menu (TI PONTO) */
.nav a[href="#/"] > .ico, .bottom-nav a[href="#/"] > .ico { background: #3b82f6; }
.nav a[href="#/ponto"] > .ico, .bottom-nav a[href="#/ponto"] > .ico { background: #f97316; }
.nav a[href="#/espelho"] > .ico, .bottom-nav a[href="#/espelho"] > .ico { background: #0ea5e9; }
.nav a[href="#/solicitacoes"] > .ico, .bottom-nav a[href="#/solicitacoes"] > .ico { background: #8b5cf6; }
.nav a[href="#/aprovacoes"] > .ico, .bottom-nav a[href="#/aprovacoes"] > .ico { background: #10b981; }
.nav a[href="#/alertas"] > .ico, .bottom-nav a[href="#/alertas"] > .ico { background: #dc2626; }
.nav a[href="#/funcionarios"] > .ico, .bottom-nav a[href="#/funcionarios"] > .ico { background: #6366f1; }
.nav a[href="#/espelhos"] > .ico, .bottom-nav a[href="#/espelhos"] > .ico { background: #db2777; }
.nav a[href="#/config"] > .ico, .bottom-nav a[href="#/config"] > .ico { background: #64748b; }
.nav a[href="#/acesso"] > .ico, .bottom-nav a[href="#/acesso"] > .ico { background: #0d9488; }
.nav a[href="#/backup"] > .ico, .bottom-nav a[href="#/backup"] > .ico { background: #b45309; }
.bottom-nav a#nav-mais > .ico { background: #475569; }
.nav-qtd { margin-left: auto; background: var(--laranja); color: #fff; border-radius: 999px; font-size: 0.72rem; font-weight: 700; padding: 1px 7px; }
.bottom-nav .nav-qtd { position: absolute; margin: -34px 0 0 26px; }
.bottom-nav a { position: relative; }
.nav a { position: relative; }

/* ---------- Ponto ---------- */
.relogio { text-align: center; }
.relogio .hora { font-size: 3.2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--royal-escuro); letter-spacing: 1px; }
:root[data-theme='escuro'] .relogio .hora { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='claro']) .relogio .hora { color: var(--text); } }
.relogio .data { color: var(--muted); }
.cam { position: relative; width: 100%; max-width: 420px; margin: 12px auto; aspect-ratio: 4 / 3; background: #000; border-radius: 10px; overflow: hidden; }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam .overlay { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 0.9rem; text-align: center; padding: 16px; }
.btn-bater { width: 100%; max-width: 420px; padding: 18px; font-size: 1.25rem; border-radius: 12px; }
.ok-badge { background: #dcfce7; color: #166534; }
.erro-badge { background: #fee2e2; color: #991b1b; }
.aviso-badge { background: #fef3c7; color: #92400e; }
:root[data-theme='escuro'] .ok-badge { background: #14321f; color: #86efac; }
:root[data-theme='escuro'] .erro-badge { background: #3a1616; color: #fca5a5; }
:root[data-theme='escuro'] .aviso-badge { background: #3a2a10; color: #fcd34d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='claro']) .ok-badge { background: #14321f; color: #86efac; }
  :root:not([data-theme='claro']) .erro-badge { background: #3a1616; color: #fca5a5; }
  :root:not([data-theme='claro']) .aviso-badge { background: #3a2a10; color: #fcd34d; }
}
.batidas { list-style: none; margin: 0; padding: 0; }
.batidas li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.batidas li:last-child { border-bottom: 0; }
.batidas .h { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Espelho */
.tabela-wrap { overflow-x: auto; }
table.espelho { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.espelho th { text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.espelho td { padding: 6px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.espelho .num { text-align: right; font-variant-numeric: tabular-nums; }
table.espelho tr.off td { color: var(--muted); }
.pos { color: #15803d; }
.neg { color: var(--danger); }
:root[data-theme='escuro'] .pos { color: #86efac; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='claro']) .pos { color: #86efac; } }
.thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; vertical-align: middle; cursor: zoom-in; }

/* Solicitacoes e alertas */
.item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; box-shadow: var(--sombra); }
.item .tit { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 0.85rem; }
.item .acoes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.alta { border-left: 4px solid var(--danger); }
.item.media { border-left: 4px solid var(--laranja); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.qr-cartao { border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; }
.qr-cartao img { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 8px; }
.qr-cartao a { word-break: break-all; font-size: 0.85rem; }
code { background: var(--hover); padding: 1px 5px; border-radius: 5px; font-size: 0.85rem; }

@media print {
  .sidebar, .mobile-header, .bottom-nav, .no-print, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
}
.nav a[href="#/fechamento"] > .ico, .bottom-nav a[href="#/fechamento"] > .ico { background: #059669; }
.nav a[href="#/relatorios"] > .ico, .bottom-nav a[href="#/relatorios"] > .ico { background: #9333ea; }
.nav a[href="#/escalas"] > .ico, .bottom-nav a[href="#/escalas"] > .ico { background: #0284c7; }
table.espelho input[type='time'] { padding: 5px 6px; min-width: 96px; }
.sidebar { overflow-y: auto; }
.painel-alerta { display: flex; gap: 10px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--border); color: var(--text); }
.painel-alerta:first-of-type { border-top: 0; }
[hidden] { display: none !important; }
.nav a[href="#/quiosques"] > .ico, .bottom-nav a[href="#/quiosques"] > .ico { background: #334155; }

/* ---------- Quiosque ---------- */
.quiosque { min-height: 100vh; background: var(--royal-escuro); color: #fff; display: flex; flex-direction: column; }
.q-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 3px solid var(--laranja); flex-wrap: wrap; }
.q-topo button { color: #fff; }
.q-corpo { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 20px; align-items: center; max-width: 1100px; width: 100%; margin: 0 auto; }
.q-hora { font-size: 4.5rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.q-data { text-align: center; opacity: 0.85; margin-bottom: 8px; }
.q-dir { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.q-msg { font-size: 1.3rem; opacity: 0.9; }
.q-pin { height: 48px; font-size: 2.6rem; letter-spacing: 12px; min-width: 200px; text-align: center; border-bottom: 2px solid rgba(255,255,255,.4); }
.q-teclado { display: grid; grid-template-columns: repeat(3, 88px); gap: 12px; }
.q-teclado button { height: 72px; font-size: 1.8rem; font-weight: 700; border-radius: 14px; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.q-teclado button:hover { background: rgba(255,255,255,.2); }
.q-teclado button.primary { background: var(--laranja); border-color: var(--laranja); }
.q-resultado { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 1.5rem; z-index: 60; padding: 20px; }
.q-resultado.ok { background: #15803d; }
.q-resultado.erro { background: #b91c1c; }
.q-nome { font-size: 2.4rem; font-weight: 800; margin-bottom: 8px; }
.q-res-hora { font-size: 4rem; font-weight: 800; margin-top: 10px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .q-corpo { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .q-hora { font-size: 3rem; }
  .q-teclado { grid-template-columns: repeat(3, 76px); }
  .q-teclado button { height: 62px; }
}
.q-rosto { margin-top: 6px; width: 288px; padding: 14px; font-size: 1.2rem; font-weight: 700; border-radius: 14px; background: #fff; color: var(--royal-escuro); border: 0; }
@media (max-width: 760px) { .q-rosto { width: 252px; } }

/* ---------- Icones do menu: canto cortado (identidade do TI PONTO) ---------- */
.nav a > .ico, .bottom-nav a > .ico {
  border-radius: 0;
  clip-path: polygon(22% 0, 100% 0, 100% 78%, 78% 100%, 0 100%, 0 22%);
  transition: transform 0.12s;
}
.nav a.active > .ico, .bottom-nav a.active > .ico { box-shadow: none; transform: scale(1.12); }
.nav a:hover > .ico { transform: scale(1.06); }
.nav a > .ico .tic { stroke-width: 2.2; }
