/* Jow NFC Leituras — mesma identidade do jownfc.com.br (jow-system-2.0):
   fundo quase preto, superfícies um pouco mais claras com borda fina, texto
   em tons de cinza, botão principal em pílula branca, fonte Manrope e o
   monograma "J" prateado. Movimento curto, e "reduzir movimento" desliga. */

/* Manrope — SIL Open Font License 1.1 (fonts/OFL-Manrope.txt). */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/manrope-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/manrope-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/manrope-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/manrope-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/manrope-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/manrope-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #0d0d0d;
  --surface-2: #121212;
  --surface-3: #181818;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #fafafa;
  --text-2: #a7a6a6;
  --text-3: #8b8a8a;
  --text-nav: #b6b5b5;
  --ok: #86c79c;
  --no: #e8908b;
  --no-bg: rgba(232, 144, 139, .12);
  --no-line: rgba(232, 144, 139, .30);
  --warn: #d8b46e;
  --warn-bg: rgba(216, 180, 110, .12);
  --warn-line: rgba(216, 180, 110, .30);
  --prata: linear-gradient(150deg, #ffffff 0%, #d6d6d6 32%, #8e8e8e 56%, #ececec 80%, #a2a2a2 100%);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --font: 'Manrope', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur: .32s;
  --sidebar: 252px;
  --bottomnav: 62px;

  /* Tons que mudam com o tema (escuro é o padrão). */
  --selection: rgba(255, 255, 255, .22);
  --focus: rgba(255, 255, 255, .7);
  --hover: rgba(255, 255, 255, .06);
  --hover-soft: rgba(255, 255, 255, .05);
  --hover-faint: rgba(255, 255, 255, .04);
  --active: rgba(255, 255, 255, .08);
  --active-strong: rgba(255, 255, 255, .14);
  --line-hover: rgba(255, 255, 255, .22);
  --line-focus: rgba(255, 255, 255, .55);
  --focus-ring: rgba(255, 255, 255, .08);
  --primary-bg: #ffffff;
  --primary-hover: #e6e6e6;
  --primary-text: #050505;
  --sidebar-bg: #080808;
  --bar-bg: #121212;
  --bar-glass: linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .06)), rgba(8, 8, 8, .86);
  --tabbar-bg: #0b0b0b;
  --handle: rgba(255, 255, 255, .22);
  --chart-grid: rgba(255, 255, 255, .07);
  --card-shadow: none;
  --bar-neutro: #6b6b6b;

  /* Dourado: só detalhes (faixa "vendo como", barras do gráfico, ícones dos
     números do painel e o selo "Demonstração"). Metálico sutil. */
  --ouro: linear-gradient(135deg, #f4e4ad 0%, #d8b45f 28%, #b8892f 55%, #e9cf88 80%, #a97b28 100%);
  --ouro-texto-sobre: #1d1505;
  --ouro-claro: #f3e2a8;
  --ouro-1: #f0d993;
  --ouro-2: #c9a24d;
  --ouro-3: #9c7a32;
  --ouro-barra: linear-gradient(180deg, #c9a24d 0%, #b08a3a 45%, #96752f 100%);
  --ouro-barra-forte: linear-gradient(180deg, #f0d993 0%, #d2ad57 100%);
}

/* ---------- Tema claro ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-3: #f2f2f0;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --text: #0a0a0a;
  --text-2: #525252;
  --text-3: #6b6b6b;
  --text-nav: #3a3a3a;
  --ok: #2f7a4d;
  --no: #b3453f;
  --no-bg: rgba(179, 69, 63, .08);
  --no-line: rgba(179, 69, 63, .30);
  --shadow: 0 18px 50px rgba(0, 0, 0, .14);
  --selection: rgba(0, 0, 0, .12);
  --focus: rgba(0, 0, 0, .6);
  --hover: rgba(0, 0, 0, .045);
  --hover-soft: rgba(0, 0, 0, .04);
  --hover-faint: rgba(0, 0, 0, .03);
  --active: rgba(0, 0, 0, .06);
  --active-strong: rgba(0, 0, 0, .09);
  --line-hover: rgba(0, 0, 0, .24);
  --line-focus: rgba(0, 0, 0, .5);
  --focus-ring: rgba(0, 0, 0, .06);
  --primary-bg: #0a0a0a;
  --primary-hover: #2a2a2a;
  --primary-text: #ffffff;
  --sidebar-bg: #fbfbfa;
  --bar-bg: #ffffff;
  --bar-glass: linear-gradient(rgba(255, 255, 255, .72), rgba(255, 255, 255, .72)), rgba(250, 250, 249, .86);
  --tabbar-bg: #ffffff;
  --handle: rgba(0, 0, 0, .18);
  --chart-grid: rgba(0, 0, 0, .07);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04);
  --bar-neutro: #8a8a8a;
  --ouro-barra: linear-gradient(180deg, #b8913f 0%, #a8812f 45%, #8a6a25 100%);
  --ouro-barra-forte: linear-gradient(180deg, #d2ad57 0%, #b08a3a 100%);
  --ouro-1: #c9a24d;
  --ouro-2: #a8812f;
  --ouro-3: #7d5f1f;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f4f2;
    --surface: #ffffff;
    --surface-2: #fafaf9;
    --surface-3: #f2f2f0;
    --line: rgba(0, 0, 0, .08);
    --line-strong: rgba(0, 0, 0, .14);
    --text: #0a0a0a;
    --text-2: #525252;
    --text-3: #6b6b6b;
    --text-nav: #3a3a3a;
    --ok: #2f7a4d;
    --no: #b3453f;
    --no-bg: rgba(179, 69, 63, .08);
    --no-line: rgba(179, 69, 63, .30);
    --shadow: 0 18px 50px rgba(0, 0, 0, .14);
    --selection: rgba(0, 0, 0, .12);
    --focus: rgba(0, 0, 0, .6);
    --hover: rgba(0, 0, 0, .045);
    --hover-soft: rgba(0, 0, 0, .04);
    --hover-faint: rgba(0, 0, 0, .03);
    --active: rgba(0, 0, 0, .06);
    --active-strong: rgba(0, 0, 0, .09);
    --line-hover: rgba(0, 0, 0, .24);
    --line-focus: rgba(0, 0, 0, .5);
    --focus-ring: rgba(0, 0, 0, .06);
    --primary-bg: #0a0a0a;
    --primary-hover: #2a2a2a;
    --primary-text: #ffffff;
    --sidebar-bg: #fbfbfa;
    --bar-bg: #ffffff;
    --bar-glass: linear-gradient(rgba(255, 255, 255, .72), rgba(255, 255, 255, .72)), rgba(250, 250, 249, .86);
    --tabbar-bg: #ffffff;
    --handle: rgba(0, 0, 0, .18);
    --chart-grid: rgba(0, 0, 0, .07);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04);
  --bar-neutro: #8a8a8a;
    --ouro-barra: linear-gradient(180deg, #b8913f 0%, #a8812f 45%, #8a6a25 100%);
    --ouro-barra-forte: linear-gradient(180deg, #d2ad57 0%, #b08a3a 100%);
  --ouro-1: #c9a24d;
  --ouro-2: #a8812f;
  --ouro-3: #7d5f1f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 500; letter-spacing: -.01em; }
p { margin: 0 0 12px; }
a { color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--selection); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: none; fill: currentColor; }
[hidden] { display: none !important; }

/* ---------- Marca: monograma "J" prateado (igual ao jownfc.com.br) ---------- */
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark {
  position: relative; flex: none; overflow: hidden;
  width: 36px; height: 36px; border-radius: 11px;
  background: #0d0d0d; border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.brand-mark::after {
  content: ''; position: absolute; inset: 15%;
  background: var(--prata);
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M8.5%204.5h8.5v10.2a5.3%205.3%200%200%201-10.6%200v-1.2'%20fill='none'%20stroke='black'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M8.5%204.5h8.5v10.2a5.3%205.3%200%200%201-10.6%200v-1.2'%20fill='none'%20stroke='black'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand-mark--sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-text { font-size: 15.5px; font-weight: 400; color: var(--text-2); letter-spacing: -.005em; line-height: 1.25; }
.brand-text strong { color: var(--text); font-weight: 500; }
.brand-text small { display: block; font-size: 12px; color: var(--text-3); }

/* ---------- Botões ---------- */
.btn {
  -webkit-appearance: none; appearance: none; position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  font: 500 14px var(--font); letter-spacing: .005em; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--line-hover); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg.i { width: 18px; height: 18px; }
/* Principal: pílula branca, com o reflexo que atravessa no hover (landing). */
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary::after {
  content: ''; position: absolute; inset: -2px auto -2px -60%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
  transform: skewX(-18deg); opacity: 0;
}
@media (hover: hover) { .btn-primary:hover::after { animation: jow-reflexo .9s var(--ease); } }
@media (hover: none) { .btn-primary:hover { background: var(--primary-bg); } }
@keyframes jow-reflexo { 0% { left: -60%; opacity: 0; } 15% { opacity: .55; } 100% { left: 120%; opacity: 0; } }
/* Destrutivo: vermelho sóbrio. */
.btn-danger { background: transparent; border-color: var(--no-line); color: var(--no); }
.btn-danger:hover { background: var(--no-bg); border-color: var(--no); }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--hover); border-color: transparent; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; border-color: var(--line-strong); color: var(--text-2); }
.btn-icon:hover { color: var(--text); }
.btn-icon svg.i { width: 17px; height: 17px; }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  display: block; width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: var(--text); outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover { border-color: var(--line-hover); }
.input:focus { border-color: var(--line-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
input.input, select.input { height: 44px; }
textarea.input { resize: vertical; min-height: 64px; line-height: 1.5; }
select.input {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #a7a6a6 50%), linear-gradient(135deg, #a7a6a6 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); margin-bottom: 14px; cursor: pointer; min-height: 36px; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }
.form-error {
  background: var(--no-bg); border: 1px solid var(--no-line); color: var(--no);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.45;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 17px; font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 16px 17px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
/* Ordem igual à do sistema: rótulo, valor, detalhe. */
.stat > div:first-child { display: contents; }
.stat .label { order: 1; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 500; }
.stat .value { order: 2; font-size: 30px; font-weight: 400; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .sub { order: 3; font-size: 12px; color: var(--text-2); margin-top: 3px; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--ouro); color: var(--ouro-texto-sobre); border: 1px solid transparent;
}
.badge-gray { background: var(--hover-soft); color: var(--text-2); border-color: var(--line); }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.empty { text-align: center; padding: 44px 20px; }
.empty h3 { font-size: 18px; font-weight: 400; letter-spacing: -.01em; margin-bottom: 6px; }
.empty p { color: var(--text-2); font-size: 13.5px; max-width: 46ch; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

/* ---------- Tabelas (computador) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 500; padding: 14px 16px 10px; white-space: nowrap;
}
.table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .2s var(--ease); }
.table tbody tr:hover { background: var(--surface-3); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn-icon { margin-left: 5px; }
.table .cell-title { font-weight: 500; }
.table .cell-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---------- Lista de cartões (celular) ---------- */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.item { padding: 16px; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-title { font-weight: 500; font-size: 15.5px; }
.item-sub { color: var(--text-2); font-size: 13px; margin-top: 4px; word-break: break-word; line-height: 1.45; }
.item-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.item-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; text-align: center; }
.item-nums div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 4px; }
.item-nums strong { display: block; font-size: 19px; font-weight: 400; font-variant-numeric: tabular-nums; }
.item-nums span { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.item-nums .item-total { border-color: var(--line-strong); background: var(--hover); }
.item-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.item-actions .btn { min-height: 44px; }

/* Link para gravar no NFC */
.linkbox {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px;
}
/* O link inteiro numa linha; os botões embaixo, dividindo a largura. */
.linkbox code { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; color: var(--text); padding: 2px 4px 4px; }
.linkbox .btn { flex: 1 1 0; min-height: 40px; padding: 0 14px; font-size: 13px; }

/* ---------- Filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.toolbar .field { margin: 0; min-width: 220px; }
.toolbar .spacer { flex: 1; }
.updated { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: jow-pulso 2s ease-in-out infinite alternate; }
@keyframes jow-pulso { from { opacity: .45; } to { opacity: 1; } }

.footnote { margin-top: 22px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------- Estrutura: computador ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  background: var(--sidebar-bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 24px; padding: 22px 14px 18px; overflow-y: auto;
}
.sidebar .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  color: var(--text-nav); text-decoration: none; font-weight: 500; font-size: 14.5px; line-height: 1.3;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.nav a svg.i { color: var(--text-3); transition: color .2s var(--ease); }
.nav a:hover { background: var(--hover-soft); color: var(--text); }
.nav a:hover svg.i, .nav a.active svg.i { color: var(--text); }
.nav a.active { background: var(--active); border-color: var(--line); color: var(--text); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 4px 0; }
.sidebar-foot .who { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .muted { font-size: 12.5px; color: var(--text-3) !important; }
.sidebar-foot .btn { width: 100%; margin-top: 12px; justify-content: flex-start; border-color: var(--line-strong); color: var(--text); }

.main { margin-left: var(--sidebar); padding: 26px 28px 40px; }
.main-inner { max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; font-weight: 400; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; max-width: 62ch; }

/* Entrada da tela: só na troca de aba (o JS põe a classe). */
@keyframes jow-entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view--entrando { animation: jow-entrar var(--dur) var(--ease) both; }

.topbar, .bottomnav, .only-mobile { display: none; }

/* Faixa "Você está vendo como" */
.banner {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 9px 28px; background: var(--ouro); border-bottom: 1px solid rgba(0, 0, 0, .18);
  color: var(--ouro-texto-sobre); font-size: 13.5px; font-weight: 500;
}
.banner strong { color: inherit; font-weight: 700; }
.banner .btn { min-height: 34px; padding: 0 14px; font-size: 13px; background: #0a0a0a; border-color: #0a0a0a; color: var(--ouro-claro); }
.banner .btn:hover { background: #262626; border-color: #262626; }
.with-banner .sidebar { top: 52px; }

/* ---------- Estrutura: celular e tablet ---------- */
@media (max-width: 899px) {
  .sidebar, .only-desktop { display: none !important; }
  .only-mobile { display: block; }
  .list.only-mobile { display: grid; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 20;
    padding: calc(10px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    background: var(--bar-bg); border-bottom: 1px solid var(--line-strong);
  }
  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .topbar {
      background: var(--bar-glass);
      -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
    }
  }
  .topbar .btn-icon { width: 40px; min-height: 40px; }
  .main { margin-left: 0; padding: 16px max(14px, env(safe-area-inset-right)) calc(var(--bottomnav) + 28px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .page-head h1 { font-size: 24px; }
  .page-head .btn { width: 100%; min-height: 48px; font-size: 15px; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--tabbar-bg); border-top: 1px solid var(--line-strong);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  /* O fundo continua abaixo da borda da tela (elástico da rolagem do iPhone). */
  .bottomnav::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 120px; background: var(--tabbar-bg); }
  .bottomnav a {
    flex: 1; min-width: 0; height: var(--bottomnav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-3); text-decoration: none; font: 500 10.5px var(--font); transition: color .2s var(--ease);
  }
  .bottomnav a svg.i { width: 44px; height: 28px; padding: 4px 11px; border-radius: var(--radius-pill); transition: background .2s var(--ease); }
  .bottomnav a.active { color: var(--text); }
  .bottomnav a.active svg.i { background: var(--active-strong); }

  .card { border-radius: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat .value { font-size: 24px; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .toolbar .field { min-width: 0; }
  .toolbar .spacer { display: none; }
  .toolbar .updated { grid-column: 1 / -1; }
  .banner { position: static; padding: 10px 14px; justify-content: space-between; font-size: 13px; }
  .grid-2 { grid-template-columns: 1fr; }
  .input, select.input, textarea.input { font-size: 16px; } /* iPhone: menos de 16px dá zoom */
  .btn-icon { width: 44px; min-height: 44px; }
}
/* Tablet: duas colunas de cartões */
@media (min-width: 600px) and (max-width: 899px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats > .stat:last-child:nth-child(odd) { grid-column: auto; }
  .page-head { flex-direction: row; align-items: flex-end; }
  .page-head .btn { width: auto; min-height: 44px; }
}

/* ---------- Janela (modal) ---------- */
dialog.modal {
  border: 1px solid var(--line-strong); padding: 0; border-radius: 20px;
  width: min(520px, calc(100vw - 48px)); max-height: 88vh; max-height: 88dvh;
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow);
}
dialog.modal[open] { animation: jow-modal var(--dur) var(--ease); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .72); animation: jow-fundo var(--dur) var(--ease); }
:root[data-theme="light"] dialog.modal::backdrop { background: rgba(10, 10, 10, .35); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) dialog.modal::backdrop { background: rgba(10, 10, 10, .35); } }
@keyframes jow-modal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes jow-fundo { from { opacity: 0; } to { opacity: 1; } }
@keyframes jow-folha { from { transform: translateY(100%); } to { transform: none; } }
.modal form { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 20px; font-weight: 400; letter-spacing: -.01em; }
.modal-head .btn-icon { border-color: transparent; }
.modal-body { padding: 20px 20px 4px; overflow-y: auto; -webkit-overflow-scrolling: touch; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.modal-body strong { color: var(--text); font-weight: 500; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (max-width: 899px) {
  dialog.modal {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0;
    max-height: 94vh; max-height: 94dvh;
  }
  dialog.modal[open] { animation: jow-folha var(--dur) var(--ease); }
  /* Alça de arrastar (só visual), como no sistema. */
  .modal form::before { content: ''; align-self: center; flex: none; width: 38px; height: 4px; border-radius: 4px; background: var(--handle); margin-top: 10px; }
  .modal-head { padding-top: 12px; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface-2); }
  .modal-foot .btn { flex: 1; min-height: 48px; font-size: 15px; }
}

/* ---------- Aviso rápido: pílula com ponto de cor ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 100;
  display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text);
  padding: 11px 18px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; transform: translate(-50%, 10px); pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 899px) { .toast { bottom: calc(var(--bottomnav) + 16px + env(safe-area-inset-bottom)); } }

/* ---------- Tela de login (igual ao Entrar do jownfc.com.br) ---------- */
.auth {
  width: min(100%, 420px); margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
  padding: max(24px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  animation: jow-entrar .45s var(--ease) both;
}
.auth-brand { justify-content: center; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px 24px; }
.auth-card h1 { font-size: 28px; font-weight: 400; letter-spacing: -.02em; line-height: 1.15; }
.auth-card > p { margin: 6px 0 20px; color: var(--text-2); font-size: 14px; }
.auth-card .btn { width: 100%; min-height: 48px; font-size: 15px; margin-top: 4px; }
.auth .input { font-size: 16px; }
.auth-foot { text-align: center; color: var(--text-3); font-size: 12.5px; }

/* ---------- Visão geral (admin) ---------- */
.stat-link { text-decoration: none; color: inherit; transition: border-color .2s var(--ease), background .2s var(--ease); }
.stat-link:hover { border-color: var(--line-strong); background: var(--surface-2); }
.stat-link .value svg.i { width: 28px; height: 28px; color: var(--text-2); }

/* ---------- QR Code ---------- */
.qr-box { display: grid; place-items: center; background: #fff; border-radius: var(--radius-sm); padding: 12px; }
.qr-box img { width: min(280px, 100%); height: auto; image-rendering: pixelated; }

/* ---------- Gráfico de 30 dias (barras como no Painel do sistema) ---------- */
.chart-card { margin-bottom: 18px; }
.chart { padding: 20px 20px 16px; }
.chart-plot { position: relative; height: 200px; margin-left: 32px; }
.chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid div { border-top: 1px solid var(--chart-grid); height: 0; position: relative; }
.chart-grid span { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; outline: none; border-radius: 4px; transition: background .2s var(--ease); }
.chart-col:hover, .chart-col.on, .chart-col:focus-visible { background: var(--hover-faint); }
.chart-bar { width: 100%; max-width: 24px; background: var(--ouro-barra); border-radius: 4px 4px 0 0; transition: background .2s var(--ease); transform-origin: bottom; }
.chart-col:hover .chart-bar, .chart-col.on .chart-bar { background: var(--ouro-barra-forte); }
/* Barras sobem só na primeira carga, não a cada atualização de 15 s. */
.chart--entrando .chart-bar { animation: jow-barra .5s var(--ease) both; }
@keyframes jow-barra { from { transform: scaleY(0); } to { transform: none; } }
.chart-x { display: flex; gap: 2px; margin: 8px 0 0 32px; }
.chart-x span { flex: 1; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: visible; }
.chart-tip {
  position: absolute; top: -8px; transform: translate(-50%, -100%); z-index: 5; pointer-events: none; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px; color: var(--text-2);
}
.chart-tip strong { color: var(--text); font-weight: 500; }
.chart-tip .muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 899px) {
  .chart { padding: 16px 12px 12px; }
  .chart-plot { height: 160px; margin-left: 26px; }
  .chart-x { margin-left: 26px; }
}

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

/* ---------- Ícone dourado dos números do painel ---------- */
.stat-icon {
  position: absolute; top: 15px; right: 15px; width: 20px; height: 20px; background: var(--ouro);
  -webkit-mask: var(--icone) center / contain no-repeat; mask: var(--icone) center / contain no-repeat;
}
.stat-icon--hoje { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H5V8h14zM7 10h5v5H7z'/%3E%3C/svg%3E"); }
.stat-icon--mes { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 16H5V10h14zM7 12h2v2H7zm4 0h2v2h-2zm4 0h2v2h-2zm-8 4h2v2H7zm4 0h2v2h-2zm4 0h2v2h-2z'/%3E%3C/svg%3E"); }
.stat-icon--total { --icone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 18.49 9.5 12.48l4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z'/%3E%3C/svg%3E"); }

/* ---------- Configurações ---------- */
.settings { max-width: 640px; }
.settings .card-pad > p { color: var(--text-2); font-size: 13.5px; margin: 4px 0 16px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill); }
.segmented button {
  -webkit-appearance: none; appearance: none; background: transparent; border: 0; cursor: pointer; min-height: 40px;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: var(--radius-pill);
  color: var(--text-2); font: 500 13.5px var(--font); transition: background .2s var(--ease), color .2s var(--ease);
}
.segmented button svg.i { width: 17px; height: 17px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--primary-bg); color: var(--primary-text); }
.settings-note { margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 899px) {
  .segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .segmented { border-radius: 18px; }
  /* Celular: ícone em cima do nome, para "Automático" caber inteiro. */
  .segmented button { flex-direction: column; justify-content: center; gap: 4px; min-height: 60px; padding: 8px 4px; border-radius: 15px; font-size: 13px; }
}

/* ---------- Ícone da aba ativa em dourado ---------- */
.nav a.active svg.i, .bottomnav a.active svg.i { fill: url(#jl-ouro); animation: jow-ativo .25s var(--ease); }
@keyframes jow-ativo { from { opacity: .4; transform: scale(.88); } to { opacity: 1; transform: none; } }
.settings .card + .card { margin-top: 14px; }
.settings form .btn { margin-top: 2px; }

/* ---------- Comparação com o período anterior ---------- */
.stat .delta { order: 3; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.stat .sub { order: 4; }
.delta strong { font-weight: 600; }
.delta--up strong { color: var(--ok); }
.delta--down strong { color: var(--no); }
.delta--flat strong { color: var(--text-2); }

/* ---------- Ranking de unidades ---------- */
#ranking, #picos { margin-bottom: 18px; }
.rank-head { flex-wrap: wrap; }
.segmented--sm button { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.rank { list-style: none; margin: 0; padding: 6px 20px 14px; }
.rank-row {
  display: grid; grid-template-columns: 40px minmax(120px, 1.2fr) 2fr 220px; align-items: center; gap: 14px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.rank-row:first-child { border-top: 0; }
.rank-pos {
  display: inline-grid; place-items: center; width: 32px; height: 26px; border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--hover); font-variant-numeric: tabular-nums;
}
/* 1º lugar: o único detalhe dourado do card. */
.rank-row--first .rank-pos { background: var(--ouro); color: var(--ouro-texto-sobre); }
.rank-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 4px; background: var(--bar-neutro); transition: width .4s var(--ease); }
.rank-nums { text-align: right; font-size: 13px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-nums strong { color: var(--text); font-weight: 600; }
.rank-note { margin: 0; padding: 0 20px 16px; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 899px) {
  .rank { padding: 4px 16px 12px; }
  .rank-row { grid-template-columns: 36px 1fr; grid-template-areas: 'pos name' 'pos bar' 'pos nums'; gap: 6px 12px; }
  .rank-pos { grid-area: pos; align-self: start; }
  .rank-name { grid-area: name; }
  .rank-bar { grid-area: bar; }
  .rank-nums { grid-area: nums; }
  .rank-head .segmented { width: 100%; }
  .rank-note { padding: 0 16px 14px; }
}
@media (max-width: 899px) { .segmented--sm button { min-height: 40px; padding: 6px 4px; } }
@media (max-width: 899px) { .rank-nums { text-align: left; } }

/* ---------- Horários e dias de pico ---------- */
.peaks { padding: 16px 20px 18px; }
.peaks-phrase { margin: 0 0 4px; font-size: 14.5px; color: var(--text-2); }
.peaks-phrase strong { color: var(--text); font-weight: 600; }
.peaks-note { margin: 0; font-size: 12.5px; color: var(--text-3); }
.peaks-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; margin-top: 18px; }
.peaks-grid h3 { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 10px; }
.mini-plot { position: relative; height: 120px; border-bottom: 1px solid var(--chart-grid); }
.mini-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.mini-bar { width: 100%; max-width: 24px; min-height: 2px; background: var(--bar-neutro); border-radius: 4px 4px 0 0; transition: background .2s var(--ease); }
.chart-col:hover .mini-bar, .chart-col.on .mini-bar { background: var(--text-2); }
/* O pico (melhor hora / melhor dia) é o único detalhe dourado. */
.mini-bar--peak, .chart-col:hover .mini-bar--peak, .chart-col.on .mini-bar--peak { background: var(--ouro-barra); }
.mini-x { display: flex; gap: 2px; margin-top: 6px; }
.mini-x span { flex: 1; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: visible; }
@media (max-width: 899px) {
  .peaks { padding: 14px 16px 16px; }
  .peaks-grid { grid-template-columns: 1fr; gap: 22px; }
}

/* ---------- Usuários (gerentes) ---------- */
.users-intro { margin: 0; padding: 14px 20px 0; font-size: 13.5px; color: var(--text-2); }
.users { list-style: none; margin: 0; padding: 6px 20px 14px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-main { min-width: 0; }
.user-actions { display: flex; gap: 8px; flex: none; }
.unit-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; }
.unit-checks .check { margin-bottom: 4px; }
@media (max-width: 899px) {
  #usuarios .card-head { flex-wrap: wrap; }
  #usuarios .card-head .btn { width: 100%; min-height: 46px; }
  .users-intro { padding: 12px 16px 0; }
  .users { padding: 4px 16px 12px; }
  .user-row { flex-direction: column; align-items: stretch; }
  .user-actions .btn { flex: 1; min-height: 44px; }
}
