/* ==========================================================================
   Fisco-e Patrimônio — estilos
   Mesmo sistema de design do e-FISCOE (app de laudos): petróleo (marca),
   âmbar (ação), dourado da logo, fonte Plus Jakarta Sans, cinzas tingidos de
   azul. Tema claro/escuro via [data-theme] ou preferência do sistema.
   ========================================================================== */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../assets/fonts/plus-jakarta-sans-latin-ext.woff2) format("woff2-variations");
  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: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../assets/fonts/plus-jakarta-sans-latin.woff2) format("woff2-variations");
  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;
}

:root {
  --brand-950: #031722;
  --brand-900: #062232;
  --brand-800: #0A2F45;
  --brand-700: #0E5577;
  --brand-600: #136C93;
  --brand-500: #1B85B0;
  --brand-50: #EBF4F8;
  --sun: #F7B733;
  --sun-600: #E39A12;
  --sun-700: #7A4E00;
  --sun-50: #FFF3D9;

  --bg: #EDF2F5;
  --surface: #FBFCFD;
  --surface-2: #F1F5F8;
  --surface-3: #E3EBF0;
  --text: #0B2433;
  --text-2: #33566A;
  --muted: #4D6B7D;
  --border: #D3DFE6;
  --border-strong: #BCCDD8;
  --hairline: rgba(11, 36, 51, .08);
  --primary: var(--brand-700);
  --on-primary: #fff;
  --link: var(--brand-600);
  --focus: rgba(27, 127, 170, .28);

  --success: #0E7550;
  --success-bg: #E3F5EC;
  --danger: #C5303C;
  --danger-bg: #FDECEE;
  --warning: #9A6200;
  --warning-bg: #FFF4D6;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-lg: 0 8px 24px rgba(11, 36, 51, .14);
  --shadow-card: none;
  --card-border: var(--hairline);
  --nav-active: var(--brand-700);
  --plaq-bg: #FFF3D9;
  --plaq-fg: #7A4E00;
  --plaq-border: #F3D9A0;
  --topbar-bg: rgba(237, 242, 245, .82);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 60px;
  --top-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #051521;
    --surface: #0B2131;
    --surface-2: #0F293B;
    --surface-3: #143247;
    --text: #E7F0F5;
    --text-2: #B0C4D0;
    --muted: #8099A9;
    --border: #1B3A4E;
    --border-strong: #275069;
    --hairline: rgba(231, 240, 245, .08);
    --primary: #1C77A3;
    --on-primary: #fff;
    --link: #7CC6EA;
    --shadow-card: none;
    --card-border: var(--hairline);
    --nav-active: #7CC6EA;
    --plaq-bg: rgba(247, 183, 51, .12);
    --plaq-fg: #F7B733;
    --plaq-border: rgba(247, 183, 51, .28);
    --topbar-bg: rgba(5, 21, 33, .82);
    --focus: rgba(124, 198, 234, .3);
    --success: #4CC796;
    --success-bg: rgba(76, 199, 150, .13);
    --danger: #FF7A85;
    --danger-bg: rgba(255, 122, 133, .12);
    --warning: #F7C548;
    --warning-bg: rgba(247, 197, 72, .12);
    --brand-50: rgba(124, 198, 234, .09);
    --sun-50: rgba(255, 214, 10, .1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #051521;
  --surface: #0B2131;
  --surface-2: #0F293B;
  --surface-3: #143247;
  --text: #E7F0F5;
  --text-2: #B0C4D0;
  --muted: #8099A9;
  --border: #1B3A4E;
  --border-strong: #275069;
  --hairline: rgba(231, 240, 245, .08);
  --primary: #1C77A3;
  --on-primary: #fff;
  --link: #7CC6EA;
  --shadow-card: none;
  --card-border: var(--hairline);
  --nav-active: #7CC6EA;
  --plaq-bg: rgba(247, 183, 51, .12);
  --plaq-fg: #F7B733;
  --plaq-border: rgba(247, 183, 51, .28);
  --topbar-bg: rgba(5, 21, 33, .82);
  --focus: rgba(124, 198, 234, .3);
  --success: #4CC796;
  --success-bg: rgba(76, 199, 150, .13);
  --danger: #FF7A85;
  --danger-bg: rgba(255, 122, 133, .12);
  --warning: #F7C548;
  --warning-bg: rgba(247, 197, 72, .12);
  --brand-50: rgba(124, 198, 234, .09);
  --sun-50: rgba(255, 214, 10, .1);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--text); font-weight: 500; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
::selection { background: var(--sun); color: var(--brand-900); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- telas de acesso (como o login do e-FISCOE) ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--brand-800); position: relative; overflow: hidden;
}
.auth-brand {
  position: relative; z-index: 1; color: #fff;
  padding: calc(32px + var(--safe-top)) 20px 24px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.auth-brand .mark { width: 34px; height: 56px; object-fit: contain; }
.auth-brand .wordmark { display: grid; font-weight: 700; font-size: 2rem; line-height: 1.05; letter-spacing: -.01em; color: #fff; margin-top: 12px; }
.auth-brand .wordmark i { font-style: normal; color: #F0A060; }
.auth-brand .wordmark small { font-size: 1.1rem; font-weight: 500; letter-spacing: 0; color: #BFD7E4; margin-top: 4px; }
.auth-brand .tag { color: #BFD7E4; font-size: .92rem; margin-top: 8px; }
.auth-card {
  position: relative; z-index: 1; flex: 1;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 28px 20px calc(28px + var(--safe-bottom));
  animation: up .4s var(--ease) both;
}
.auth-card h1 { font-size: 1.5rem; }
.auth-card .lead { color: var(--muted); font-size: .92rem; margin: 8px 0 24px; }
.auth-foot { margin-top: 24px; text-align: center; font-size: .84rem; color: var(--muted); }
@media (min-width: 960px) {
  .auth { flex-direction: row; align-items: stretch; }
  .auth-brand { flex: 1; justify-content: center; padding: 48px 6vw; }
  .auth-brand .mark { width: 40px; height: 66px; }
  .auth-brand .wordmark { font-size: 3.2rem; }
  .auth-brand .tag { font-size: 1.05rem; max-width: 420px; }
    .auth-card {
    flex: 0 0 520px; border-radius: 0; overflow-y: auto; max-height: 100vh;
    display: flex; flex-direction: column; justify-content: center; padding: 48px 56px;
  }
  .auth-card > * { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
}

/* ---------- estrutura ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; }
.main { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  min-height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex; align-items: center; gap: 12px;
  background: var(--topbar-bg); color: var(--text);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.brand-text { display: grid; line-height: 1.1; min-width: 0; }
.brand-name { font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-name i { font-style: normal; color: #B4521E; }
.brand-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; }
:root[data-theme="dark"] .brand-name i { color: #F0A060; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-name i { color: #F0A060; } }
.topbar .spacer { flex: 1; }

/* Envio: só um ícone. Fica quieto quando não há nada pendente e chama atenção
   apenas quando há itens a enviar, sem internet ou enviando. */
.sync-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.sync-btn:hover { background: var(--surface-3); color: var(--text); }
.sync-btn svg.ic { width: 22px; height: 22px; }
.sync-btn.pending, .sync-btn.off { color: var(--text); }
.sync-btn.spin svg.ic { animation: spin 1s linear infinite; }
.sync-btn .count {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--sun); color: var(--brand-900);
  font-size: .66rem; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}

main.view {
  display: block;
  padding: 16px 16px calc(var(--nav-h) + 32px + var(--safe-bottom));
  max-width: 1080px; margin: 0 auto;
}
@media (prefers-reduced-motion: no-preference) {
  main.view { animation: fade .2s var(--ease) both; }
}

/* Navegação inferior (celular) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center;
  padding: 4px 8px calc(4px + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.navlink {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; border-radius: 10px;
  color: var(--muted); font-size: .66rem; font-weight: 600;
  transition: color .15s, background-color .15s;
}
.navlink svg.ic { width: 18px; height: 18px; }
.navlink.active { color: var(--nav-active); }
.navlink .dot {
  position: absolute; top: 0; left: calc(50% + 4px);
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--sun); color: var(--brand-900);
  font-size: .66rem; font-style: normal; line-height: 18px; text-align: center; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Barra lateral (computador) */
.sidenav { display: none; }
@media (min-width: 960px) {
  .sidenav {
    display: flex; flex-direction: column; gap: 2px;
    width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    padding: 20px 16px; background: var(--brand-900); color: #fff;
  }
  .sidenav .brand { padding: 4px 8px 24px; color: #fff; }
  .sidenav .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .sidenav .brand-name i { color: #F0A060; }
  .sidenav .brand-sub { color: #8FB3C6; }
  .sidenav .navlink {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 8px;
    min-height: 36px; padding: 0 8px; border-radius: 8px;
    color: #A9C4D3; font-size: .9rem; font-weight: 400;
  }
  .sidenav .navlink svg.ic { width: 18px; height: 18px; }
  .sidenav .navlink:hover { background: rgba(255, 255, 255, .06); color: #fff; }
  .sidenav .navlink.active { background: rgba(255, 255, 255, .08); color: #fff; font-weight: 500; }
  .sidenav .navlink.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 2px 2px 0; background: var(--sun); }
  .sidenav .navlink .dot { position: static; margin-left: auto; }
  .sidenav .who {
    margin-top: auto; display: flex; align-items: center; gap: 12px;
    padding: 12px 8px; border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .8rem; color: #A9C4D3;
  }
  .sidenav .who b { display: block; color: #fff; font-size: .86rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidenav .who > div { min-width: 0; }
  .sidenav .fisco { display: block; padding: 16px 8px 0; }
  .topbar { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0 32px; min-height: 64px; }
  .topbar .brand { display: none; }
  .bottomnav { display: none; }
  main.view { padding: 8px 32px 48px; }
}
@media (max-width: 959px) { .sidenav .brand, .sidenav .who, .sidenav .fisco { display: none; } }

/* Avatar com iniciais */
.avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-700); color: #fff; font-size: .86rem; font-weight: 600;
}
.avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 1.05rem; }

/* ---------- Início (modelo A) ---------- */
/* Cabeçalho petróleo com a faixa âmbar (o mesmo do e-FISCOE); os cartões sobem sobre ele */
.hero {
  position: relative; overflow: hidden; color: #fff; background: var(--brand-800);
  margin: -16px -16px 0; padding: 8px 16px 56px;
}
.hero-art { position: absolute; inset: 0; pointer-events: none; }
.hero-art svg { position: absolute; right: 0; bottom: 0; width: 100%; height: 100%; }
.hero .inner { position: relative; z-index: 1; display: grid; gap: 4px; }
.hero .eyebrow { font-size: .82rem; color: #9DB8C7; }
.hero h1 { font-size: 1.6rem; line-height: 1.2; color: #fff; overflow-wrap: anywhere; }
.hero .cnpj { font-size: .82rem; color: #C8DDE8; font-variant-numeric: tabular-nums; }
.hero select.input { margin-top: 12px; max-width: 480px; color: #fff; background-color: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); }
.hero select.input option { color: var(--text); background: var(--surface); }
.hero-kpi { display: flex; align-items: flex-end; gap: 12px; margin-top: 16px; }
.hero-kpi span { display: block; font-size: .82rem; color: #9DB8C7; }
.hero-kpi b { display: block; font-size: 2.25rem; line-height: 1.1; font-weight: 500; color: var(--sun); font-variant-numeric: tabular-nums; }
.hero-kpi em { display: block; font-style: normal; font-size: .82rem; color: #4CC796; margin-top: 2px; }
.hero + .card { position: relative; margin-top: -36px; }
.stat-card > .stat-split:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 959px) {
  .topbar.on-hero { background: var(--brand-800); color: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topbar.on-hero .brand { color: #fff; }
  .topbar.on-hero .brand-name i { color: #F0A060; }
  .topbar.on-hero .brand-sub { color: #9DB8C7; }
  .topbar.on-hero .sync-btn { color: #C8DDE8; }
  .topbar.on-hero .sync-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
}
@media (min-width: 960px) {
  .hero { margin: 0; border-radius: var(--radius-lg); padding: 24px 32px 64px; }
}
.stat-card { display: grid; gap: 16px; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--brand-600); }
:root[data-theme="dark"] .bar > i { background: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar > i { background: var(--link); } }
.bar-note { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.stat-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; }
.stat-split span { display: block; font-size: .8rem; color: var(--muted); }
.stat-split b { font-size: 1.25rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.home-actions { margin-top: 16px; }
.home-actions .btn { min-height: 52px; }
.recent { margin-top: 24px; }
.recent-head { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 8px; }
.recent-head h2 { font-size: 1rem; font-weight: 500; }
.recent-head a { font-size: .86rem; font-weight: 500; }
.recent .card { padding: 0; overflow: hidden; }
.rec-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 60px; padding: 8px 16px; color: var(--text); border-bottom: 1px solid var(--border); }
.rec-row:last-child { border-bottom: 0; }
.rec-row:hover { background: var(--surface-2); }
.rec-row .t { display: grid; min-width: 0; }
.rec-row .t b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-row .t span, .rec-row time { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-more { margin-top: 24px; }

/* ---------- cabeçalho de página ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { flex: 1; min-width: 0; font-size: 1.35rem; }
.page-head .sub { display: block; font-size: .84rem; font-weight: 400; color: var(--muted); margin-top: 4px; letter-spacing: 0; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: transform .12s var(--ease), background-color .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }

/* ---------- cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card + .card, .card + .stack, .stack + .card, .card + .list, .list + .card { margin-top: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-title h2 { flex: 1; min-width: 0; }
.card-title > svg.ic { color: var(--muted); }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 > .btn, .grid-3 > .btn { min-width: 0; padding-left: 12px; padding-right: 12px; }
@media (max-width: 480px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 960px) { .card { padding: 20px; } }

.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--brand-50); color: var(--brand-700); font-size: .88rem; line-height: 1.5;
}
:root[data-theme="dark"] .banner { color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner { color: var(--link); } }
.banner svg.ic { margin-top: 2px; }
.banner.warn { background: var(--warning-bg); color: var(--warning); }
.banner.ok { background: var(--success-bg); color: var(--success); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner + * { margin-top: 12px; }
.banner b { font-weight: 600; }

/* ---------- formulários ---------- */
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: .76rem; color: var(--muted); }
.err { font-size: .8rem; color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 16px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background-color: var(--surface-2); color: var(--text);
  font: inherit; font-size: 16px; /* evita zoom no iOS */
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea.input { min-height: 88px; resize: vertical; line-height: 1.5; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E8494' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--brand-500); background-color: var(--surface); box-shadow: 0 0 0 4px var(--focus); }
.input[readonly], .input:disabled { opacity: .7; cursor: not-allowed; }
.input.invalid { border-color: var(--danger); }
.input.sm { min-height: 40px; padding-top: 8px; padding-bottom: 8px; font-size: .9rem; width: auto; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.input-group .icon-btn { height: 48px; width: 48px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap button {
  position: absolute; right: 4px; top: 4px; height: 40px; width: 40px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px;
}
.check { display: flex; gap: 12px; align-items: center; font-size: .88rem; color: var(--text-2); cursor: pointer; line-height: 1.4; }
.check input { width: 20px; height: 20px; accent-color: var(--brand-600); flex: none; }

/* Busca */
.search { position: relative; flex: 1; min-width: 0; }
.search > svg.ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 44px; background-color: var(--surface); border-color: var(--hairline); }

/* ---------- botões ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px;
  border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 500; font-size: .95rem; line-height: 1.2;
  cursor: pointer; user-select: none; white-space: nowrap; text-align: center;
  background: var(--primary); color: var(--on-primary);
  transition: transform .12s var(--ease), filter .15s, background-color .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn-accent { background: var(--primary); color: var(--on-primary); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); filter: none; }
.btn-ghost { background: transparent; color: var(--link); }
.btn-ghost:hover { background: var(--brand-50); filter: none; }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-bg); filter: none; }
.btn-danger.solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1rem; }
.btn-sm { min-height: 36px; padding: 8px 12px; font-size: .85rem; border-radius: 8px; }
.btn .spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.actions { display: grid; gap: 8px; margin-top: 16px; }
.actions.two { grid-template-columns: 1fr 1fr; }

/* ---------- foto ---------- */
.form-top { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: stretch; }
.photo-box {
  position: relative;
  width: 112px; min-height: 112px; height: 100%;
  border-radius: var(--radius); overflow: hidden;
  border: 2px dashed var(--border-strong);
  background: var(--surface-2); color: var(--link);
  display: grid; place-items: center; align-content: center; gap: 4px;
  font: inherit; font-size: .76rem; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.photo-box:hover { border-color: var(--brand-500); background: var(--brand-50); }
.photo-box svg.ic { width: 24px; height: 24px; }
.photo-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-box.has { border-style: solid; border-color: var(--hairline); }
.viewer img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-sm); background: #000; }

/* ---------- listas ---------- */
.list {
  display: grid; background: var(--surface); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 16px; width: 100%; min-height: 72px;
  background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  color: var(--text); cursor: pointer; text-align: left; font: inherit;
  transition: background-color .15s;
}
.item:last-child { border-bottom: 0; }
button.item:hover { background: var(--surface-2); }
.item.noimg { grid-template-columns: 1fr auto; cursor: default; }
.thumb {
  width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-3); color: var(--muted); display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-main { min-width: 0; display: grid; gap: 2px; }
.item-title { font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-desc b { font-weight: 500; }
.item-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-side { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sun-600); }

/* O nº do patrimônio como a plaqueta âmbar */
.plaqueta {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 7px; border-radius: 6px;
  background: var(--plaq-bg); border: 1px solid var(--plaq-border); color: var(--plaq-fg);
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.menu-list { display: grid; background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 16px; width: 100%;
  color: var(--text); background: none; border: 0; border-bottom: 1px solid var(--border);
  font: inherit; text-align: left; cursor: pointer; transition: background-color .15s;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .mi-ic { width: 24px; display: grid; place-items: center; color: var(--muted); flex: none; }
.menu-item .mi-text { flex: 1; min-width: 0; }
.menu-item .mi-text small { display: block; color: var(--muted); font-size: .8rem; }
.menu-item > svg.ic:last-child { color: var(--muted); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .mi-ic { color: var(--danger); }

/* ---------- selos e números ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge.primary { background: var(--brand-50); color: var(--link); }
.badge.accent { background: var(--sun-50); color: var(--sun-700); }
:root[data-theme="dark"] .badge.accent { color: var(--sun); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.accent { color: var(--sun); } }
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .88rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- abas / segmentado / chave ---------- */
.segmented { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s;
}
.segmented button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.segmented .count { opacity: .75; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 16px; padding: 4px 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex-shrink: 0; border: 1px solid var(--hairline); background: var(--surface); color: var(--text-2);
  padding: 8px 16px; border-radius: 8px; font: inherit; font-size: .86rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.tabs button.on { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.switch-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .txt { flex: 1; min-width: 0; }
.switch-row .txt small { display: block; color: var(--muted); font-size: .8rem; }
.switch { position: relative; width: 44px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: var(--border-strong); transition: background-color .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--brand-600); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:disabled + i { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px var(--focus); }

/* ---------- tabela ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { font-size: .74rem; font-weight: 500; color: var(--muted); }
.tbl td.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }

/* ---------- vazio / diversos ---------- */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty .ill { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--link); margin-bottom: 4px; }
.empty .ill svg.ic { width: 24px; height: 24px; }
.empty h3 { color: var(--text); }
.empty p { max-width: 360px; font-size: .9rem; }
.empty .btn { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 4px 4px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .86rem;
}
.chip [data-ren] { cursor: pointer; }
.chip [data-ren]:hover { color: var(--link); }
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; }
.chip button:hover { color: var(--danger); background: var(--danger-bg); }
.chip svg.ic { width: 14px; height: 14px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-label { font-size: .82rem; font-weight: 500; color: var(--muted); margin: 24px 4px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin: 16px 0 12px; }
.toolbar .segmented { flex-wrap: nowrap; min-width: 0; gap: 6px; }
.toolbar .segmented button { padding: 0 10px; gap: 4px; }
.toolbar select.input.sm { flex: none; min-height: 36px; padding: 0 26px 0 10px; border-radius: 18px; background-size: 16px; border-width: 1px; background-color: var(--surface); background-position: right 8px center; font-size: .84rem; }
.foot-note { margin-top: 12px; text-align: center; font-size: .8rem; color: var(--muted); }

/* ---------- avisos e janelas ---------- */
#toasts {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px + var(--safe-bottom));
  display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
@media (min-width: 960px) { #toasts { bottom: 24px; left: calc(50% + 132px); } }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--brand-900); color: #E7F0F5; box-shadow: var(--shadow-lg);
  font-size: .9rem; animation: rise .2s var(--ease);
}
.toast.ok svg.ic { color: #4CC796; }
.toast.warn svg.ic { color: var(--sun); }
.toast.err svg.ic { color: #FF7A85; }
.toast button { margin-left: auto; background: var(--sun); color: var(--brand-900); border: 0; border-radius: 8px; padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.modal-back {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 20, 31, .55);
  display: grid; align-items: end; justify-items: center;
  animation: fade .2s;
}
.modal {
  width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto;
  background: var(--surface); color: var(--text);
  border-radius: 20px 20px 0 0; padding: 24px 20px calc(20px + var(--safe-bottom));
  animation: up .3s var(--ease);
}
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); }
}
.modal h2 { margin-bottom: 8px; font-size: 1.2rem; }
.modal .msg { color: var(--text-2); }
.modal .actions { grid-template-columns: 1fr 1fr; }
.modal .actions.one { grid-template-columns: 1fr; }
.scanner { margin-top: 12px; }
.scanner video { width: 100%; border-radius: var(--radius-sm); background: #000; aspect-ratio: 4 / 3; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
