/* =========================================================
   Tokens — paleta do gabinete
   ========================================================= */
:root {
  --navy: #030D4F;
  --gold: #FFC52C;
  --head-2: #17226A;

  --bg: #F2F3F8;
  --surface: #FFFFFF;
  --surface-2: #F7F8FC;
  --ink: #0A1240;
  --muted: #5A6185;
  --line: #E2E4EE;

  /* Ação principal: navy no claro, dourado no escuro */
  --primary: var(--navy);
  --on-primary: #FFFFFF;
  --focus: #4352A3;

  /* Situação das demandas */
  --ok-fg: #1B6B3A;      --ok-bg: #E3F3E8;
  --late-fg: #A8321E;    --late-bg: #FBE7E3;
  --prog-fg: #1E3FA8;    --prog-bg: #E3E9FD;
  --wait-fg: #7A5300;    --wait-bg: #FFF2C9;
  --off-fg: #5A6185;     --off-bg: #ECEEF4;

  /* Escala do mapa (menos → mais) */
  --map-1: #FFF4D6;
  --map-2: #C9CEEA;
  --map-3: #8C95CF;
  --map-4: #4352A3;
  --map-5: #030D4F;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(3, 13, 79, .06), 0 4px 16px rgba(3, 13, 79, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060A22;
    --surface: #0F1538;
    --surface-2: #151C45;
    --ink: #E9ECF8;
    --muted: #9AA2C8;
    --line: #232B5C;
    --primary: var(--gold);
    --on-primary: var(--navy);
    --focus: #FFC52C;
    --ok-fg: #7FD6A0;   --ok-bg: rgba(27, 107, 58, .28);
    --late-fg: #FF9C88; --late-bg: rgba(168, 50, 30, .28);
    --prog-fg: #A9BBFF; --prog-bg: rgba(30, 63, 168, .32);
    --wait-fg: #FFD772; --wait-bg: rgba(122, 83, 0, .32);
    --off-fg: #9AA2C8;  --off-bg: rgba(90, 97, 133, .25);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #060A22;
  --surface: #0F1538;
  --surface-2: #151C45;
  --ink: #E9ECF8;
  --muted: #9AA2C8;
  --line: #232B5C;
  --primary: var(--gold);
  --on-primary: var(--navy);
  --focus: #FFC52C;
  --ok-fg: #7FD6A0;   --ok-bg: rgba(27, 107, 58, .28);
  --late-fg: #FF9C88; --late-bg: rgba(168, 50, 30, .28);
  --prog-fg: #A9BBFF; --prog-bg: rgba(30, 63, 168, .32);
  --wait-fg: #FFD772; --wait-bg: rgba(122, 83, 0, .32);
  --off-fg: #9AA2C8;  --off-bg: rgba(90, 97, 133, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* =========================================================
   Base (mobile-first: estilos para celular; telas maiores
   ajustam com @media (min-width: …))
   Pontos de quebra: 600px · 768px (tabelas) · 1024px (menu lateral)
   ========================================================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.3rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
a { color: inherit; }
button, a, input, select, textarea, label { touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

@media (min-width: 768px) {
  body { font-size: 14px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1rem; }
}

/* =========================================================
   Layout
   Celular/tablet: barra superior + barra de abas inferior;
   o menu completo abre como gaveta.
   Computador (≥1024px): menu lateral fixo.
   ========================================================= */
.shell { min-height: 100vh; min-height: 100dvh; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--gold); color: var(--navy);
  display: grid; place-items: center; font-weight: 800; font-size: 1rem;
}
img.brand-mark { border-radius: 50%; object-fit: cover; background: none; }
.brand strong { display: block; font-size: 1rem; }
.brand span { font-size: .75rem; opacity: .7; }

/* Menu completo — gaveta no celular */
.sidebar {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: min(284px, 86vw);
  height: 100vh; height: 100dvh;
  transform: translateX(-100%); transition: transform .2s ease, visibility .2s;
  visibility: hidden;
}
.shell.menu-aberto .sidebar {
  transform: none; visibility: visible;
  box-shadow: 0 0 0 100vmax rgba(3, 13, 79, .5);
}
body:has(.shell.menu-aberto) { overflow: hidden; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--head-2); color: #fff; }
.nav a.ativo { background: var(--gold); color: var(--navy); font-weight: 650; }
.nav svg { width: 20px; height: 20px; flex: none; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 14px; display: grid; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--head-2); color: var(--gold);
  display: grid; place-items: center; font-weight: 700; flex: none;
}
.user-chip div { min-width: 0; }
.user-chip strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip span { font-size: .75rem; opacity: .7; }
.foot-actions { display: flex; gap: 6px; }
.foot-actions button, .foot-actions a {
  flex: 1; background: var(--head-2); color: #fff; border: 0; border-radius: 8px;
  min-height: 44px; padding: 7px 8px; font: inherit; font-size: .8rem; cursor: pointer;
  display: grid; place-items: center; text-align: center; text-decoration: none; line-height: 1.2;
}
.foot-actions button:hover, .foot-actions a:hover { background: #22308a; }

/* Barra superior (celular) */
.topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--navy); color: #fff;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand-mark { width: 30px; height: 30px; }
.topbar strong { font-size: 1rem; }

/* Barra de abas inferior (celular) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
  background: var(--navy); color: #fff;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 54px; padding: 6px 2px; border: 0; border-radius: 10px;
  background: none; color: rgba(255, 255, 255, .72); cursor: pointer;
  font: inherit; font-size: .7rem; font-weight: 600; text-decoration: none; line-height: 1.1;
}
.tab svg { width: 22px; height: 22px; }
.tab.ativo { color: var(--gold); }
.tab-novo { gap: 4px; color: rgba(255, 255, 255, .85); }
.tab-novo .bola {
  width: 50px; height: 50px; margin-top: -24px; border-radius: 50%;
  background: var(--gold); color: var(--navy); display: grid; place-items: center;
  border: 4px solid var(--navy); box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.tab-novo .bola svg { width: 24px; height: 24px; stroke-width: 2.4; }

.content {
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 240px; }
.page-head > .btn, .page-head > .acoes-linha { flex: 1 1 100%; }
.page-head > .acoes-linha .btn { flex: 1 1 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

@media (min-width: 600px) {
  .page-head { margin-bottom: 20px; }
  .page-head > .btn, .page-head > .acoes-linha { flex: none; }
  .page-head > .acoes-linha .btn { flex: none; }
}

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; }
  .sidebar {
    position: sticky; inset: 0 auto auto 0; width: auto; height: 100vh;
    transform: none; transition: none; visibility: visible;
  }
  .topbar, .tabbar { display: none; }
  .content { padding: 28px 32px 48px; }
}

/* =========================================================
   Componentes
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 14px 16px; }
.stack { display: grid; gap: 16px; }
.grid-2, .grid-3, .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.detail-grid { align-items: start; }

@media (min-width: 700px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .card-pad { padding: 18px 20px; }
  .card-head { padding: 16px 20px; gap: 12px; }
  .card-body { padding: 16px 20px; }
}
@media (min-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  min-height: 44px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--late-bg); color: var(--late-fg); }
.btn-sm { min-height: 38px; padding: 7px 12px; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--focus); font: inherit; cursor: pointer; text-decoration: underline; }

@media (min-width: 1024px) {
  .btn { min-height: 38px; padding: 9px 16px; border-radius: 9px; }
  .btn svg { width: 16px; height: 16px; }
  .btn-sm { min-height: 32px; padding: 6px 11px; font-size: .85rem; }
  .link-btn { padding: 0; }
}

/* Badges de situação */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-ok { color: var(--ok-fg); background: var(--ok-bg); }
.s-late { color: var(--late-fg); background: var(--late-bg); }
.s-prog { color: var(--prog-fg); background: var(--prog-bg); }
.s-wait { color: var(--wait-fg); background: var(--wait-bg); }
.s-off { color: var(--off-fg); background: var(--off-bg); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; color: var(--muted); }

/* Formulários — no celular, campos com 16px (evita o zoom automático do iPhone) e altura de toque */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field > span .req { color: var(--late-fg); }
.field .erro { font-size: .8rem; color: var(--late-fg); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  min-height: 46px; padding: 10px 12px;
}
input[type="date"] { -webkit-appearance: none; appearance: none; text-align: left; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; flex: none; padding: 0; accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
.form-actions .btn { flex: 1 1 0; }
fieldset { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; min-width: 0; }
legend { padding: 0 6px; font-weight: 650; font-size: .9rem; }

@media (min-width: 600px) {
  .form-actions .btn { flex: none; }
}
@media (min-width: 700px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  input, select, textarea { font-size: inherit; min-height: 38px; padding: 9px 11px; }
  textarea { min-height: 96px; }
  .check { min-height: 0; gap: 8px; }
  .check input { width: 16px; height: 16px; }
}

/* Filtros — no celular, ficam recolhidos atrás do botão "Filtros" */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters .field { flex: 1 1 100%; }
.filters .acoes-linha { flex: 1 1 40%; }
.filters .acoes-linha .btn { flex: 1 1 0; }
.filters-toggle { flex: 1 1 40%; }
.filters-toggle svg { transition: transform .15s; }

@media (max-width: 767.98px) {
  .filters:not(.aberto) > :not(.filters-toggle):not(.sempre) { display: none; }
  .filters .check { flex: 1 1 40%; }
}
@media (min-width: 768px) {
  .filters { padding: 14px 20px; }
  .filters .field { flex: 1 1 160px; }
  .filters .field.wide { flex: 2 1 220px; }
  .filters .acoes-linha { flex: none; }
  .filters .acoes-linha .btn { flex: none; }
  .filters-toggle { display: none; }
}

/* Tabelas — no computador, tabela; no celular, cada linha vira um cartão.
   Nas células: data-label = rótulo no cartão; c-principal = título do cartão;
   c-inline = etiquetas lado a lado no topo; c-acoes = botões; c-oculta = só no computador. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--surface-2); }
td .titulo { font-weight: 600; }
td.c-acoes { text-align: right; white-space: nowrap; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

@media (max-width: 767.98px) {
  .table-wrap { overflow: visible; }
  .table-wrap thead { display: none; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
  }
  .table-wrap tbody tr:last-child { border-bottom: 0; }
  .table-wrap td { display: block; flex: 1 1 100%; min-width: 0; padding: 0; border: 0; white-space: normal; font-size: .9rem; }
  .table-wrap td[data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 6.5rem; margin-right: 6px;
    color: var(--muted); font-size: .8rem;
  }
  .table-wrap td.c-principal { order: -2; font-size: 1rem; }
  .table-wrap td.c-inline { flex: 0 0 auto; order: -1; }
  .table-wrap td.c-inline[data-label]::before { min-width: 0; }
  .table-wrap td.c-acoes { display: flex; gap: 8px; padding-top: 6px; text-align: left; }
  .table-wrap td.c-acoes .btn { flex: 1 1 0; }
  .table-wrap td.c-oculta { display: none; }
  .table-wrap tr.clicavel:hover td { background: none; }
  .table-wrap tr.clicavel:active { background: var(--surface-2); }
}

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager-btns { display: flex; gap: 8px; flex: 1 1 100%; }
.pager-btns .btn { flex: 1 1 0; }
@media (min-width: 600px) {
  .pager { padding: 12px 20px; }
  .pager-btns { flex: none; }
  .pager-btns .btn { flex: none; }
}

/* Lista de definição */
.dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0 0 10px; font-weight: 500; overflow-wrap: anywhere; }
@media (min-width: 600px) {
  .dl { grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; }
  .dl dd { margin: 0; }
}

/* Linha do tempo (histórico) */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; overflow-wrap: anywhere; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .quando { font-size: .78rem; color: var(--muted); }

/* =========================================================
   Painel
   ========================================================= */
.hero {
  background: var(--navy); color: #fff;
  border-radius: 16px; padding: 18px 16px; margin-bottom: 16px;
}
.hero h1 { color: #fff; }
.hero .sub { color: rgba(255, 255, 255, .7); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.kpi { background: var(--head-2); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: #fff; display: block; }
.kpi:hover { filter: brightness(1.15); }
.kpi.destaque { background: var(--gold); color: var(--navy); }
.kpi .rotulo { font-size: .78rem; opacity: .8; line-height: 1.25; }
.kpi .valor { font-size: 1.6rem; font-weight: 750; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) {
  .hero { padding: 22px 24px 24px; margin-bottom: 18px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
  .kpi { padding: 14px 16px; }
  .kpi .rotulo { font-size: .8rem; }
  .kpi .valor { font-size: 1.9rem; }
}

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr) 2rem; gap: 10px; align-items: center; font-size: .88rem; min-height: 32px; }
.bar-row .rotulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.bar-row .n { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) {
  .bar-row { grid-template-columns: minmax(90px, 160px) 1fr 40px; min-height: 0; }
}

.mapa { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.mapa a {
  border-radius: 10px; padding: 10px 12px; min-height: 64px; text-decoration: none;
  display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid rgba(3, 13, 79, .08);
}
.mapa a:hover { outline: 2px solid var(--gold); }
.mapa .nome { font-size: .8rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.mapa .qtd { font-size: 1.2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) {
  .mapa { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}
.m1 { background: var(--map-1); color: var(--navy); }
.m2 { background: var(--map-2); color: var(--navy); }
.m3 { background: var(--map-3); color: var(--navy); }
.m4 { background: var(--map-4); color: #fff; }
.m5 { background: var(--map-5); color: #fff; }
.m0 { background: var(--surface-2); color: var(--muted); }
.legenda { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); }
.legenda i { width: 22px; height: 10px; border-radius: 3px; display: inline-block; }

/* =========================================================
   Login
   ========================================================= */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(1200px 600px at 10% -10%, #17226A 0%, transparent 60%), var(--navy);
}
.login .card { width: 100%; max-width: 400px; padding: 24px 20px; }
.login .brand { padding: 0 0 20px; color: var(--ink); }
.login .brand-mark { width: 48px; height: 48px; }
@media (min-width: 600px) {
  .login .card { padding: 30px 28px; }
}

/* =========================================================
   Modal (no celular, abre como painel de baixo para cima),
   toasts, carregamento
   ========================================================= */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(3, 13, 79, .5);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal {
  width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  border-radius: 18px 18px 0 0; border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.modal .card-head { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal .card-head h2 { font-size: 1.05rem; }
@media (min-width: 600px) {
  .modal-fundo { align-items: center; padding: 16px; }
  .modal { max-width: 560px; max-height: calc(100vh - 32px); border-radius: var(--radius); border-bottom: 1px solid var(--line); padding-bottom: 0; }
}
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; margin: -6px -8px -6px 0; border-radius: 8px; display: grid; place-items: center; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.toasts {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 8px; z-index: 60;
}
.toast {
  background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px;
  box-shadow: var(--shadow); border-left: 4px solid var(--gold); font-weight: 500;
}
.toast.erro { border-left-color: #FF7A63; }
@media (min-width: 1024px) {
  .toasts { left: auto; right: 16px; bottom: 16px; max-width: 380px; }
}

.alerta { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--late-bg); color: var(--late-fg); font-weight: 500; }
.alerta ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.aviso { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--wait-bg); color: var(--wait-fg); }

.carregando { padding: 40px; text-align: center; color: var(--muted); }
.carregando::before {
  content: ""; display: block; margin: 0 auto 10px; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--gold); animation: gira .8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

.acoes-linha { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.resultado-busca { border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 280px; overflow-y: auto; background: var(--surface); }
.resultado-busca button {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  min-height: 48px; padding: 10px 12px; font: inherit; color: var(--ink); cursor: pointer;
}
.resultado-busca button:last-child { border-bottom: 0; }
.resultado-busca button:hover { background: var(--surface-2); }
.selecionado { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
