/* Certifico — Design tokens + base styles */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Light palette — "Cartório Digital" */
  --bg: #F4F5F7;
  --bg-2: #ECEEF2;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E1E5EB;
  --border-strong: #CBD2DB;
  --divider: #EEF0F4;
  --text: #0A0F1A;
  --text-2: #4A5568;
  --text-3: #8593A4;
  --text-on-brand: #FFFFFF;

  --brand: #1E3A5F;
  --brand-hover: #15294A;
  --brand-tint: #EAF0F7;
  --brand-tint-strong: #D6E2F0;

  --success: #1F7A3D;
  --success-tint: #E5F2EA;
  --warning: #B6620C;
  --warning-tint: #FBF1E0;
  --danger: #B41E1E;
  --danger-tint: #FCEAEA;

  --shadow-sm: 0 1px 0 rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.06);
}

.dark {
  --bg: #0B1015;
  --bg-2: #060A0F;
  --surface: #141A22;
  --surface-2: #1B232E;
  --border: #283242;
  --border-strong: #3A475C;
  --divider: #1F2733;
  --text: #ECF0F5;
  --text-2: #A0AEC0;
  --text-3: #6B7990;
  --text-on-brand: #FFFFFF;

  --brand: #6F9DD4;
  --brand-hover: #87B0E0;
  --brand-tint: rgba(111,157,212,0.14);
  --brand-tint-strong: rgba(111,157,212,0.22);

  --success: #4ADE80;
  --success-tint: rgba(74,222,128,0.12);
  --warning: #FBBF24;
  --warning-tint: rgba(251,191,36,0.12);
  --danger: #F87171;
  --danger-tint: rgba(248,113,113,0.12);
}

/* ── App shell ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Prende o app exatamente na área visível (evita "maior que a tela" no WebView iOS) */
body {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* Phone screen base */
.scr {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

.scr *, .scr *::before, .scr *::after { box-sizing: border-box; }

/* Type */
.font-display { font-family: 'Montserrat', sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.h1 { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; color: var(--text); }
.h2 { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; color: var(--text); }
.h3 { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 17px; line-height: 1.25; letter-spacing: -0.005em; color: var(--text); }
.label-xs { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-3); }
.label-sm { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.body { font-size: 14px; color: var(--text); line-height: 1.45; }
.body-sm { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.body-xs { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.num { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* Status text — color + uppercase + letter-spacing, NO pills */
.status-text { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
.status-text::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-pending { color: var(--warning); }
.status-done { color: var(--success); }
.status-fail { color: var(--danger); }
.status-info { color: var(--text-2); }
.status-text.no-dot::before { display: none; }

/* Buttons — rectangular, never round */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; padding: 12px 16px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; transition: all .12s; line-height: 1; min-height: 44px; }
.btn-primary { background: var(--brand); color: var(--text-on-brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text); border: none; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-tinted { background: var(--brand-tint); color: var(--brand); border-color: var(--brand-tint-strong); font-size: 12px; }
.btn-tinted:hover { background: var(--brand-tint-strong); }
.btn-sm { padding: 8px 12px; font-size: 11px; min-height: 32px; border-radius: 6px; }
.btn-lg { padding: 16px 20px; font-size: 14px; min-height: 52px; }
.btn-block { width: 100%; }

/* Inputs */
.input { width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; padding: 12px 12px; font-family: inherit; font-size: 14px; color: var(--text); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.input::placeholder { color: var(--text-3); }
.field-label { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-2); display: block; margin-bottom: 6px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.card-row { padding: 14px 16px; }
.divider { height: 1px; background: var(--divider); }
.divider-v { width: 1px; background: var(--divider); }

/* Top bar (in-screen) */
.appbar { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 20px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.appbar h1 { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; color: var(--text); margin: 0; flex: 1; }

/* Phone chrome */
.phone-status { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px 0 28px; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600; color: var(--text); flex: 0 0 44px; background: var(--surface); }
.phone-home { height: 28px; flex: 0 0 28px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; background: var(--surface); border-top: 1px solid var(--border); }
.phone-home-bar { width: 134px; height: 5px; border-radius: 99px; background: var(--text); opacity: .85; }
.dark .phone-status { background: var(--surface); }
.dark .phone-home { background: var(--surface); }

/* Tab bar — 4 abas (Inicio, Certidoes, Modelos, Perfil) */
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding: 8px 0 calc(4px + env(safe-area-inset-bottom)); flex-shrink: 0; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; color: var(--text-3); cursor: pointer; border: none; background: transparent; transition: color .15s; }
.tab.active { color: var(--brand); }
.tab svg { width: 22px; height: 22px; stroke-width: 1.75; }
.tab-label { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 10px; letter-spacing: 0.04em; }

/* Progress bars — rectangular, thick */
.progress { height: 18px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 0; overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 0; }
.progress-thick { height: 24px; }
.progress-thin { height: 8px; border: none; background: var(--divider); }

/* Bar chart */
.bar-track { background: var(--bg-2); border: 1px solid var(--border); }

/* Tinted info cards */
.tint-brand { background: var(--brand-tint); border: 1px solid var(--brand-tint-strong); }
.tint-warn { background: var(--warning-tint); border: 1px solid color-mix(in srgb, var(--warning) 20%, transparent); }
.tint-danger { background: var(--danger-tint); border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent); }
.tint-success { background: var(--success-tint); border: 1px solid color-mix(in srgb, var(--success) 20%, transparent); }

/* Scroll */
.scroll { overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { display: none; }

/* Misc */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.brand-text { color: var(--brand); }

/* Avatar (one of few round-allowed elements) */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: white; display: inline-flex; align-items: center; justify-content: center; font-family: 'Montserrat'; font-weight: 700; font-size: 13px; letter-spacing: 0.04em; }

/* Microcopy with letter-spaced caps */
.ls-caps { letter-spacing: 0.10em; text-transform: uppercase; font-family: 'Montserrat', sans-serif; font-weight: 700; }

/* Subtle hatched placeholder (for photo/scan placeholders) */
.hatch {
  background-image:
    linear-gradient(135deg, transparent 49%, var(--border) 49% 51%, transparent 51%);
  background-size: 8px 8px;
  background-color: var(--bg-2);
}

/* Document paper look */
.paper { background: #FCFCFA; color: #1a1a1a; border: 1px solid var(--border); }
.dark .paper { background: #F2F1ED; color: #1a1a1a; }
.paper .filled { background: #FFF59C; color: #1a1a1a; padding: 0 2px; font-weight: 600; }

/* Borders / dividers utility */
.bt { border-top: 1px solid var(--border); }
.bb { border-bottom: 1px solid var(--border); }

/* Brand glyph */
.glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--brand); color: white;
  font-family: 'Montserrat'; font-weight: 800; font-size: 14px;
  letter-spacing: -0.02em;
  border-radius: 4px;
}

/* ── App shell layout (native-style mobile) ── */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* --app-vh e definido por JS via visualViewport para altura real no WebView iOS.
     Fallback: 100% (funciona no navegador de mesa sem JS). */
  height: var(--app-vh, 100%);
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  /* subtle shadow on wide screens */
  box-shadow: 0 0 0 1px var(--border), var(--shadow-md);
}

.screen-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: var(--bg);
}

/* Wide screen (desktop preview wrapper — phone frame) */
@media (min-width: 500px) and (max-width: 767px) {
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #E8EAF0;
    min-height: 100dvh;
    padding: 20px 0;
  }
  #app {
    border-radius: 8px;
    height: calc(100dvh - 40px);
    min-height: 600px;
    max-height: 900px;
  }
}

/* ══════════════════════════════════════════════════
   TABLET LAYOUT (>= 768px)
   Shell: rail 80px esquerdo + conteúdo principal
   ══════════════════════════════════════════════════ */

@media (min-width: 768px) {
  body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    display: block;
    min-height: 100dvh;
  }

  #app {
    width: 100%;
    height: 100dvh;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: row; /* rail | main-column */
  }

  /* Rail esquerda */
  .tablet-rail {
    width: 80px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 0 14px;
    height: 100%;
    z-index: 10;
  }

  /* Logo symbol no topo da rail */
  .rail-logo {
    display: flex;
    justify-content: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
    margin-bottom: 12px;
    flex-shrink: 0;
  }

  /* Símbolo da marca na rail */
  .rail-glyph {
    width: 36px;
    height: 36px;
    background: var(--brand);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.02em;
    flex-shrink: 0;
  }

  /* Itens da nav principal da rail */
  .rail-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
    overflow: hidden;
  }

  .rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    border: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s;
    width: 100%;
    text-decoration: none;
  }

  .rail-item:hover {
    background: var(--bg);
    color: var(--text);
  }

  .rail-item.active {
    background: var(--brand-tint);
    color: var(--brand);
    border-left: 3px solid var(--brand);
  }

  .rail-item-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;
  }

  /* Botão "Capturar" primário da rail */
  .rail-item-capture {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 0 2px;
    margin: 8px 0 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
  }

  .rail-item-capture .capture-btn {
    width: 48px;
    height: 48px;
    background: var(--brand);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(30,58,95,0.25);
    transition: background .12s;
    flex-shrink: 0;
  }

  .rail-item-capture:hover .capture-btn {
    background: var(--brand-hover);
  }

  .rail-item-capture .rail-item-label {
    color: var(--text-2);
  }

  /* Rodapé da rail (Config + Perfil + avatar) */
  .rail-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 10px 0;
    border-top: 1px solid var(--divider);
    flex-shrink: 0;
  }

  .rail-footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--text-3);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    border-radius: 6px;
    transition: background .12s, color .12s;
  }

  .rail-footer-item:hover {
    background: var(--bg);
    color: var(--text-2);
  }

  .rail-footer-item.active {
    color: var(--brand);
  }

  /* Coluna principal (topbar + screen-area) */
  .tablet-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    overflow: hidden;
  }

  /* Top bar do tablet */
  .tablet-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
  }

  .tablet-topbar-title-group {
    flex: 1;
    min-width: 0;
  }

  .tablet-topbar-breadcrumb {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 2px;
  }

  .tablet-topbar-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0;
  }

  .tablet-topbar-search {
    flex: 0 1 280px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
  }

  .tablet-topbar-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
  }

  .tablet-topbar-search input::placeholder {
    color: var(--text-3);
  }

  .tablet-topbar-trailing {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  /* Area de telas no tablet (sem tabbar) */
  #screen-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* Ocultar tab bar no tablet */
  .tabbar {
    display: none !important;
  }

  /* Ocultar brandbar mobile no tablet */
  .brandbar {
    display: none !important;
  }

  /* Layout de duas colunas para conferência */
  .tablet-two-col {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    flex: 1;
    min-height: 0;
    background: var(--bg-2);
    overflow: hidden;
  }

  .tablet-two-col-left {
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    justify-content: center;
  }

  .tablet-two-col-right {
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
  }

  /* Tabela de modelos */
  .tablet-table-head {
    display: grid;
    gap: 14px;
    padding: 10px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
  }

  .tablet-table-row {
    display: grid;
    gap: 14px;
    padding: 12px 20px;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
  }

  .tablet-table-row.selected {
    background: var(--brand-tint);
    border-left: 3px solid var(--brand);
    padding-left: 17px;
  }

  /* Seção de detalhe de modelo */
  .tablet-detail-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-2);
    padding: 20px;
  }

  /* Grid de KPIs no painel */
  .tablet-kpi-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
  }

  .tablet-kpi-wide {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
  }

  /* Mapa hero no tablet (Diligências) */
  .tablet-map-hero {
    flex-shrink: 0;
    height: 360px;
    position: relative;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
  }

  /* Grid de dois cards */
  .tablet-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  /* Card header utilitário */
  .card-header {
    display: flex;
    align-items: center;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--divider);
  }

  .card-header-text {
    flex: 1;
    min-width: 0;
  }

  .card-header-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
  }

  .card-header-sub {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 2px;
  }

  .card-header-right {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
  }

  /* Barra de métricas hero no tablet */
  .tablet-metrics-bar {
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
  }
}

/* ══════════════════════════════════════════════════
   DESKTOP LAYOUT (>= 1200px)
   Shell: sidenav 240px fixo + coluna principal
   ══════════════════════════════════════════════════ */

@media (min-width: 1200px) {
  body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    display: block;
    min-height: 100dvh;
  }

  #app {
    width: 100%;
    height: 100dvh;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: row; /* sidenav | main */
  }

  /* ── Sidenav ── */
  .desktop-sidenav {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0 0 12px;
    height: 100%;
    z-index: 10;
    overflow: hidden;
  }

  .desktop-sidenav-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
  }

  .desktop-logo {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .desktop-logo-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.02em;
    color: var(--text);
  }

  .desktop-sidenav-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
  }

  .desktop-sidenav-body::-webkit-scrollbar { display: none; }

  .desktop-nav-section {
    padding: 8px 12px 10px;
  }

  .desktop-nav-section-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 6px 10px 8px;
  }

  .desktop-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    border: none;
    border-left: 2px solid transparent;
    cursor: pointer;
    width: 100%;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 13px;
    text-align: left;
    transition: background .12s, color .12s;
  }

  .desktop-nav-item:hover {
    background: var(--bg);
    color: var(--text);
  }

  .desktop-nav-item.active {
    background: var(--brand-tint);
    color: var(--brand);
    border-left-color: var(--brand);
    font-weight: 700;
    padding-left: 8px;
  }

  .desktop-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
  }

  .desktop-nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-nav-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: inherit;
    opacity: 0.75;
    flex-shrink: 0;
  }

  .desktop-nav-badge {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    flex-shrink: 0;
  }

  .desktop-sidenav-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--divider);
    flex-shrink: 0;
  }

  /* ── Coluna principal ── */
  .desktop-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    overflow: hidden;
  }

  /* ── Topbar desktop ── */
  .desktop-topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
  }

  .desktop-topbar-title-group {
    flex: 1;
    min-width: 0;
  }

  .desktop-topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-3);
  }

  .desktop-topbar-breadcrumb .active {
    color: var(--text-2);
  }

  .desktop-topbar-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0;
  }

  .desktop-topbar-search {
    flex: 0 1 360px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
  }

  .desktop-topbar-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
  }

  .desktop-topbar-search input::placeholder { color: var(--text-3); }

  .desktop-kbd {
    font-family: 'Montserrat', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-3);
    flex-shrink: 0;
  }

  .desktop-topbar-trailing {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }

  .desktop-topbar-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
  }

  .desktop-notif-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .desktop-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background: var(--danger);
    border-radius: 7px;
    font-size: 9px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .desktop-theme-btn {
    padding: 7px;
    min-height: unset;
  }

  /* ── Área de telas ── */
  .desktop-screen-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
  }

  /* Ocultar tab bar e tablet rail no desktop */
  .tabbar   { display: none !important; }
  .brandbar { display: none !important; }

  /* ── KPIs ── */
  .desktop-kpi-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
  }

  .desktop-kpi-card {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 18px 14px;
  }

  .desktop-kpi-header {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .desktop-kpi-value {
    font-size: 30px;
    font-weight: 600;
    line-height: 1;
    margin-top: 6px;
  }

  .desktop-kpi-trend {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  /* ── Card header ── */
  .desktop-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--divider);
  }

  .desktop-card-header-right {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
  }

  /* ── Tabela desktop ── */
  .desktop-table-head {
    display: grid;
    gap: 14px;
    padding: 10px 24px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .desktop-table-row {
    display: grid;
    gap: 14px;
    padding: 12px 24px;
    align-items: center;
    border-bottom: 1px solid var(--divider);
    background: var(--surface);
    transition: background .10s;
  }

  .desktop-table-row:hover {
    background: var(--brand-tint);
  }

  .desktop-table-row.highlighted {
    border-left: 3px solid var(--brand);
    padding-left: 21px;
    background: var(--brand-tint);
  }

  /* ── Filter bar ── */
  .desktop-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }

  .desktop-filter-count {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
  }

  .desktop-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, color .12s, border-color .12s;
  }

  .desktop-chip.active {
    background: var(--brand-tint);
    color: var(--brand);
    border-color: var(--brand);
  }

  /* ── Stats strip (certidões) ── */
  .desktop-stats-strip {
    display: flex;
    gap: 0;
    padding: 18px 24px 12px;
    background: var(--bg);
    flex-shrink: 0;
  }

  .desktop-stat-item {
    flex: 1;
    padding: 0 24px;
  }

  .desktop-stat-item:first-child { padding-left: 0; }
  .desktop-stat-item:last-child  { border-right: none; }

  /* ── Metrics strip (diligências) ── */
  .desktop-metrics-strip {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  /* ── Mapa (diligências) ── */
  .desktop-map-panel {
    position: relative;
    background: var(--surface-2);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
  }

  .desktop-map-inner {
    position: absolute;
    inset: 0;
  }

  /* ── Preview panel (modelos) ── */
  .desktop-preview-panel {
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* ── Paginação ── */
  .desktop-pagination {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
}

/* Linha de certidao na tela Home */
.home-cert-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: default;
  transition: background .10s;
}
.home-cert-row:active { background: var(--brand-tint); }

/* Chip/filter (not pill — rectangular with small radius) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip.active {
  background: var(--brand);
  color: var(--text-on-brand);
  border-color: var(--brand);
}

/* Filter strip */
.filter-strip {
  display: flex; gap: 6px; padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.filter-strip::-webkit-scrollbar { display: none; }

/* Brand bar (top of each main tab) */
.brandbar {
  display: flex; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 20px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

/* Splash screen */
.splash-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
}

/* Search bar */
.searchbar {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.searchbar input {
  flex: 1; border: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--text); outline: none;
}
.searchbar input::placeholder { color: var(--text-3); }

/* Toggle (rectangular per design system) */
.toggle {
  width: 36px; height: 20px;
  background: var(--border-strong);
  border-radius: 4px;
  position: relative;
  padding: 2px;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.toggle.on { background: var(--brand); }
.toggle-thumb {
  width: 16px; height: 16px;
  background: white;
  border-radius: 2px;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left .15s;
}
.toggle.on .toggle-thumb { left: 18px; }

/* ── Sheet de navegação (escolher Waze / Google / Apple) ── */
#nav-sheet { position: fixed; inset: 0; z-index: 4000; }
.nav-sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 15, 26, .45);
  animation: navFade .14s ease;
}
.nav-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(10, 15, 26, .18);
  animation: navUp .18s cubic-bezier(.2, .7, .2, 1);
}
.nav-sheet__panel .nav-opt { text-transform: none; letter-spacing: .01em; font-size: 14px; }
@keyframes navFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes navUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
