/* =====================================================================
   BovinoTech — design system do aplicativo
   Tokens (cor, tipo, espaço, raio, sombra) -> base -> layout -> componentes
   Tema claro/escuro: prefers-color-scheme + escolha do usuário (data-theme)
   ===================================================================== */

:root {
  color-scheme: light;
  /* superfícies */
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-2: #f8faf6;
  --surface-3: #eef2ea;
  --line: #dde4d8;
  --line-strong: #c6d1c0;
  /* texto */
  --ink: #17221a;
  --ink-2: #4b574d;
  --ink-3: #606b61;         /* texto secundário: ≥ 4,5:1 em todos os fundos claros (AA) */
  --ink-inverse: #ffffff;
  /* marca */
  --brand-950: #0f2317;
  --brand-900: #173323;
  --brand-800: #1f4430;
  --brand-700: #2a5a3f;
  --brand-600: #33704e;
  --brand-500: #3f875f;
  --brand-100: #e3efe6;
  --brand-50: #f1f7f2;
  --accent: #c9932b;
  --accent-soft: #f7ecd4;
  --link: #2a6b47;           /* texto/realce de marca com contraste AA */
  /* estados */
  --ok: #1f7a4a;       --ok-soft: #e1f2e8;
  --warn: #8a5700;     --warn-soft: #fbefd5;
  --danger: #b3261e;   --danger-soft: #fbe3e1;
  --info: #235f99;     --info-soft: #e1ecf8;
  /* gráficos (paleta validada, ver skill dataviz) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --chart-grid: #e6ebe2;
  /* tipografia */
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* forma */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(15, 35, 23, .05), 0 1px 1px rgba(15, 35, 23, .03);
  --shadow-2: 0 4px 16px -6px rgba(15, 35, 23, .14), 0 1px 3px rgba(15, 35, 23, .06);
  --shadow-3: 0 24px 48px -16px rgba(15, 35, 23, .28);
  --focus: 0 0 0 3px rgba(63, 135, 95, .35);
  /* layout */
  --sidebar-w: 264px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0f1511; --surface: #161e18; --surface-2: #1b241d; --surface-3: #222d24;
    --line: #2a362c; --line-strong: #3a473c;
    --ink: #eef3ee; --ink-2: #b5c0b6; --ink-3: #8d998e;
    --brand-100: #1d3326; --brand-50: #172a1e; --accent-soft: #3a2f16; --link: #8fdcae;
    --ok: #5fcf8f; --ok-soft: #173424; --warn: #f0b64a; --warn-soft: #3a2d12;
    --danger: #f28b82; --danger-soft: #3d1a17; --info: #8ab8ef; --info-soft: #172a40;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --chart-grid: #263128;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 6px 20px -6px rgba(0,0,0,.6); --shadow-3: 0 24px 48px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1511; --surface: #161e18; --surface-2: #1b241d; --surface-3: #222d24;
  --line: #2a362c; --line-strong: #3a473c;
  --ink: #eef3ee; --ink-2: #b5c0b6; --ink-3: #8d998e;
  --brand-100: #1d3326; --brand-50: #172a1e; --accent-soft: #3a2f16; --link: #8fdcae;
  --ok: #5fcf8f; --ok-soft: #173424; --warn: #f0b64a; --warn-soft: #3a2d12;
  --danger: #f28b82; --danger-soft: #3d1a17; --info: #8ab8ef; --info-soft: #172a40;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --chart-grid: #263128;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 6px 20px -6px rgba(0,0,0,.6); --shadow-3: 0 24px 48px -12px rgba(0,0,0,.7);
}

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
.hidden { display: none !important; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: 10px; background: var(--brand-700); color: #fff; font-weight: 600; border: 0; }
.skip-link:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.text-ok { color: var(--ok); } .text-danger { color: var(--danger); } .text-warn { color: var(--warn); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: var(--brand-100); }

.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

/* ---------------- botões ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-700); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover:not(:disabled) { background: var(--brand-800); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-3); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn .spinner { width: 16px; height: 16px; }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- formulários ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
  font-size: 15px;
}
.field textarea { min-height: 88px; resize: vertical; }
.field select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f7a70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus); }
.field input:disabled, .field select:disabled { background: var(--surface-3); color: var(--ink-3); }
.field-hint { font-size: 12.5px; color: var(--ink-3); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error { font-size: 12.5px; color: var(--danger); }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .affix { position: absolute; left: 12px; color: var(--ink-3); font-size: 14px; pointer-events: none; }
.input-affix .affix + input { padding-left: 36px !important; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; padding: 6px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand-600); }
.form-section { grid-column: 1 / -1; padding-top: 6px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-banner { grid-column: 1 / -1; padding: 12px 14px; border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.form-banner.error { background: var(--danger-soft); color: var(--danger); }
.form-banner.info { background: var(--info-soft); color: var(--info); }
.form-banner.warn { background: var(--warn-soft); color: var(--warn); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); min-height: 36px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------------- shell do app ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--brand-950); color: #d7e3da;
  display: flex; flex-direction: column; padding: 18px 12px 16px;
  scrollbar-width: thin; scrollbar-color: #2f4a39 transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none !important; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(150deg, #4f9a6f, #1f4430); color: #fff;
  font: 700 15px/1 var(--font-display); letter-spacing: .02em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand-name { font: 600 19px/1 var(--font-display); letter-spacing: -.01em; }
.brand-name small { display: block; font: 500 11px/1.2 var(--font-sans); color: #8fab98; letter-spacing: .04em; margin-top: 4px; }
.nav-group { margin-top: 6px; }
.nav-group-title { padding: 12px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7f9a87; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: #cfdcd3; text-decoration: none !important; font-size: 14.5px; font-weight: 500;
}
.nav-link .i { color: #93b09c; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: rgba(120, 190, 145, .16); color: #fff; }
.nav-link.active .i { color: #9ee0b4; }
.nav-link .nav-badge { margin-left: auto; background: var(--accent); color: #1c1405; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: #e7efe9; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2d5a40; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.user-chip .who { min-width: 0; }
.user-chip .who strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: 12px; color: #8fab98; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 700; font-size: 16px; display: none; }
.topbar-spacer { flex: 1; }
.plan-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--warn); text-decoration: none !important; }
.plan-pill.danger { background: var(--danger-soft); color: var(--danger); }
.plan-pill.ok { background: var(--brand-100); color: var(--link); }
.content { padding: 28px; width: 100%; max-width: 1280px; margin: 0 auto; flex: 1; }
.offline-bar { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; }

.bottom-nav, .mobile-only, .nav-scrim { display: none; }

/* ---------------- página ---------------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { font: 600 28px/1.15 var(--font-display); letter-spacing: -.015em; }
.page-header .sub { color: var(--ink-3); margin-top: 6px; font-size: 14.5px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--ink-3); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }

/* ---------------- cartões ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-title { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header .i { color: var(--ink-3); }
.card-body { padding: 16px 20px 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.stat-foot { font-size: 12.5px; color: var(--ink-3); }
.stat-hero .stat-value { font-size: 44px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; line-height: 1.4; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-100); color: var(--link); }
.badge .i { width: 13px; height: 13px; }

/* ---------------- toolbar / filtros ---------------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; }
.search input { width: 100%; min-height: 40px; padding: 8px 12px 8px 38px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.search input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus); }
.toolbar select { min-height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f7a70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; font-size: 14px; }
.toolbar .count { font-size: 13px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }

/* ---------------- tabelas ---------------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.data-table th {
  text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3);
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
.data-table th:first-child { border-top-left-radius: var(--r-lg); }
.data-table th:last-child { border-top-right-radius: var(--r-lg); }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--ink); }
.data-table th .sort { opacity: .5; margin-left: 4px; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table .right, .data-table th.right { text-align: right; }
.data-table td.num { white-space: nowrap; }
.data-table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.data-table td .primary { font-weight: 600; color: var(--ink); }
.data-table td .secondary { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.row-actions { display: inline-flex; gap: 2px; }
.data-cards { display: none; }
.table-more { padding: 12px; text-align: center; border-top: 1px solid var(--line); }

/* ---------------- vazio / carregando ---------------- */
.empty { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--link); margin-bottom: 4px; }
.empty-icon .i { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--ink-3); font-size: 14px; max-width: 46ch; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-block { padding: 48px; display: grid; place-items: center; color: var(--ink-3); }

/* ---------------- abas ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--link); border-bottom-color: var(--link); }

/* ---------------- alertas ---------------- */
.alert-list { display: flex; flex-direction: column; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--line); text-decoration: none !important; color: var(--ink); }
.alert-item:first-child { border-top: 0; }
.alert-item:hover { background: var(--surface-2); }
.alert-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.alert-dot .i { width: 17px; height: 17px; }
.alert-item.danger .alert-dot { background: var(--danger-soft); color: var(--danger); }
.alert-item.warning .alert-dot { background: var(--warn-soft); color: var(--warn); }
.alert-item.info .alert-dot { background: var(--info-soft); color: var(--info); }
.alert-text { font-size: 14px; line-height: 1.45; padding-top: 5px; }
.alert-meta { font-size: 12px; color: var(--ink-3); }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--info-soft); color: var(--info); font-size: 14px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.danger { background: var(--danger-soft); color: var(--danger); }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.callout .i { margin-top: 1px; }
.callout strong { color: inherit; }

/* ---------------- modal / bottom sheet ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 18, 12, .52); animation: fade .15s ease; }
.modal {
  position: relative; width: min(640px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); animation: pop .18s ease;
}
.modal.wide { width: min(880px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-header .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.modal-body { padding: 20px 22px; overflow-y: auto; overscroll-behavior: contain; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.sheet-handle { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slideup { from { transform: translateY(100%); } }

/* ---------------- toasts ---------------- */
.toast-stack { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--brand-950); color: #eaf3ec; box-shadow: var(--shadow-3); font-size: 14px; animation: pop .2s ease; }
.toast.error { background: #3b1411; color: #ffe1dd; }
.toast .i { margin-top: 1px; }
.toast.success .i { color: #8fe0ad; }
.toast.error .i { color: #ff9b91; }

/* ---------------- listas simples / timeline ---------------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 14px; }
.list-item .meta { font-size: 12.5px; color: var(--ink-3); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand-500); }
.tl-item .when { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.tl-item .what { font-size: 14px; }

/* ---------------- pastos (quadro de rotação) ---------------- */
.pasture-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pasture-tile { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.pasture-tile .name { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.pasture-tile .meta { font-size: 12.5px; color: var(--ink-3); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-500); }
.meter.warn > span { background: var(--accent); }
.meter.danger > span { background: var(--danger); }

/* ---------------- gráficos ---------------- */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-text { fill: var(--ink-3); font-size: 11px; font-family: var(--font-sans); }
.chart .value-text { fill: var(--ink-2); font-size: 12px; font-weight: 600; font-family: var(--font-sans); }
.chart .label-text { fill: var(--ink); font-size: 13px; font-family: var(--font-sans); }
.chart .hit { fill: transparent; cursor: default; touch-action: pan-y; }
.chart .hit:hover + .mark, .chart .bar-group:hover .mark { opacity: .85; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tooltip { position: absolute; pointer-events: none; z-index: 5; background: var(--brand-950); color: #fff; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-2); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.chart-tooltip strong { display: block; margin-bottom: 2px; }
.chart-tooltip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 12px; align-items: center; font-size: 13.5px; }
.hbar .lbl { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; }
.hbar .fill { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.hbar .val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 48px; text-align: right; }

/* ---------------- clima ---------------- */
.weather-now { display: flex; align-items: center; gap: 16px; }
.weather-now .temp { font-size: 40px; font-weight: 600; letter-spacing: -.03em; }
.weather-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.weather-day { text-align: center; padding: 8px 4px; border-radius: 10px; background: var(--surface-2); font-size: 12px; }
.weather-day b { display: block; font-size: 12px; color: var(--ink-2); }
.weather-day .rain { color: var(--info); font-weight: 600; }

/* ---------------- onboarding ---------------- */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none !important; color: var(--ink); }
.step:hover { border-color: var(--brand-500); }
.step-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-100); color: var(--link); font-weight: 700; flex: none; }
.step.done .step-num { background: var(--ok); color: #fff; }
.step.done .step-title { text-decoration: line-through; color: var(--ink-3); }
.step-title { font-weight: 600; }
.step-desc { font-size: 13px; color: var(--ink-3); }

/* ---------------- ações rápidas ---------------- */
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; }
.quick-btn:hover { border-color: var(--brand-500); background: var(--brand-50); }
.quick-btn .qi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-100); color: var(--link); }
.quick-btn.fin .qi { background: var(--accent-soft); color: var(--warn); }
.quick-grid.compact { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.plan-feat { display: flex; gap: 8px; align-items: flex-start; }
.plan-feat .i { margin-top: 3px; }
.quick-btn.san .qi { background: var(--info-soft); color: var(--info); }

/* ---------------- mapa ---------------- */
.map { height: 420px; border-radius: var(--r-md); border: 1px solid var(--line); overflow: hidden; background: var(--surface-3); z-index: 0; }
.map.tall { height: 560px; }
.map-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.map-status { font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.map-status.ok { color: var(--ok); font-weight: 600; }
.map-status.warn { color: var(--danger); font-weight: 600; }
.leaflet-container { font-family: var(--font-sans) !important; }
.pasture-label { background: rgba(15, 35, 23, .8) !important; color: #fff !important; border: 0 !important; border-radius: 6px !important; box-shadow: none !important; font-weight: 600; padding: 2px 6px !important; }
.pasture-label::before { display: none; }

/* ---------------- auth ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside {
  position: relative; overflow: hidden; padding: 48px 56px; color: #e7f0e9;
  background: radial-gradient(120% 90% at 0% 0%, #2a5a3f 0%, #173323 45%, #0f2317 100%);
  display: flex; flex-direction: column;
}
.auth-aside .brand { padding: 0; }
.auth-aside h2 { font: 600 40px/1.1 var(--font-display); color: #fff; letter-spacing: -.02em; margin-top: auto; max-width: 16ch; }
.auth-aside p { color: #b9ccbf; margin-top: 16px; max-width: 46ch; font-size: 16px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 auto; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: #dbe7de; font-size: 15px; }
.auth-points .i { color: #9ee0b4; }
.auth-aside .horizon { position: absolute; left: 0; right: 0; bottom: 0; height: 90px; opacity: .25; pointer-events: none; background: repeating-linear-gradient(100deg, transparent 0 14px, rgba(158,224,180,.4) 14px 15px); mask-image: linear-gradient(to top, #000, transparent); -webkit-mask-image: linear-gradient(to top, #000, transparent); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font: 600 30px/1.15 var(--font-display); letter-spacing: -.015em; }
.auth-card .sub { color: var(--ink-3); margin: 8px 0 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 14px; color: var(--ink-3); }
.auth-mobile-brand { display: none; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px !important; }

/* ---------------- relatório impresso ---------------- */
.report-doc { background: #fff; color: #111; max-width: 960px; margin: 0 auto; padding: 40px 44px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.report-doc h1 { font: 600 26px/1.2 var(--font-display); color: #0f2317; }
.report-doc h2 { font-size: 15px; font-weight: 700; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 2px solid #1f4430; color: #0f2317; text-transform: uppercase; letter-spacing: .04em; }
.report-doc .meta { color: #555; font-size: 13px; margin-top: 6px; }
.report-doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-doc th { text-align: left; background: #eef3ee; padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.report-doc td { padding: 6px 8px; border-bottom: 1px solid #e3e8e3; }
.report-doc .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.report-doc .kpi { border: 1px solid #dfe6df; border-radius: 10px; padding: 10px 12px; }
.report-doc .kpi span { display: block; font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: .04em; }
.report-doc .kpi b { font-size: 18px; }
.report-doc .empty-note { color: #777; font-size: 12.5px; font-style: italic; }

/* ---------------- verificação em duas etapas ---------------- */
.totp-setup { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 18px; align-items: start; }
.totp-qr { width: 176px; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.totp-qr svg { width: 100%; height: auto; }
.totp-steps { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
.totp-setup details summary { cursor: pointer; font-size: 13.5px; color: var(--link); font-weight: 600; }
.totp-key { display: inline-block; margin-top: 8px; font: 600 14px/1.5 var(--font-mono); letter-spacing: .06em; background: var(--surface-3); padding: 6px 10px; border-radius: 8px; word-break: break-all; user-select: all; }
.field input.code-input { font: 600 24px/1 var(--font-mono); letter-spacing: .32em; text-align: center; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font: 600 15px/1.4 var(--font-mono); }
.recovery-codes span { background: var(--surface-3); border-radius: 8px; padding: 8px 10px; text-align: center; user-select: all; }
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-3); font: 600 20px/1.3 var(--font-mono); letter-spacing: .04em; word-break: break-all; }

/* ---------------- conversa com o suporte ---------------- */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; background: var(--surface-3); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-body { white-space: pre-wrap; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; display: flex; gap: 8px; flex-wrap: wrap; white-space: normal; }
.msg.mine { align-self: flex-end; background: var(--brand-100); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.internal { align-self: stretch; max-width: none; background: var(--warn-soft); border: 1px dashed var(--warn); }
.reply-box { display: flex; flex-direction: column; gap: 10px; }
.reply-box textarea { width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); resize: vertical; }
.reply-box textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus); }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: middle; }

/* ---------------- avisos: sininho, comunicados, modo suporte ---------------- */
.bell-btn { position: relative; }
.bell-dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.announcement { display: flex; gap: 12px; padding: 12px 14px 12px 16px; border-radius: var(--r-md); background: var(--info-soft); color: var(--info); margin-bottom: 16px; align-items: flex-start; }
.announcement.aviso, .announcement.manutencao { background: var(--warn-soft); color: var(--warn); }
.announcement.novidade { background: var(--brand-100); color: var(--link); }
.announcement .grow { flex: 1; min-width: 0; }
.announcement strong { display: block; font-size: 14.5px; }
.announcement p { color: var(--ink-2); font-size: 14px; margin-top: 2px; white-space: pre-wrap; }
.announcement .btn { color: inherit; margin: -6px -6px 0 0; }
.support-bar { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; background: #4a3408; color: #ffe3a8; font-size: 13.5px; font-weight: 600; text-align: center; }
.support-bar .btn { background: transparent; color: #ffe3a8; border: 1px solid rgba(255, 227, 168, .5); min-height: 30px; }
.support-bar .btn:hover:not(:disabled) { background: rgba(255, 227, 168, .12); border-color: #ffe3a8; }
.notif-item { display: flex; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.notif-item:first-child { border-top: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item .meta { font-size: 12.5px; color: var(--ink-3); }

/* ---------------- ajuda ---------------- */
.faq details { border-top: 1px solid var(--line); padding: 14px 20px; }
.faq details:first-child { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ''; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
.faq details p { margin-top: 8px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.contact-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------------- pesagem no curral ---------------- */
.weigh-entry { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 10px; align-items: end; }
.weigh-list { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.weigh-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.weigh-item:first-child { border-top: 0; }
.weigh-summary { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.weigh-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------------- importação de planilha ---------------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); text-align: center; color: var(--ink-2); cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--brand-500); background: var(--brand-50); }
.dropzone input { display: none; }
.error-list { margin: 0; padding-left: 18px; font-size: 13.5px; max-height: 180px; overflow-y: auto; }

/* =====================================================================
   Responsivo
   ===================================================================== */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --topbar-h: 56px; }
  .app { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); height: 100%; z-index: 120;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-3);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
  .app.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; z-index: 110; background: rgba(8, 18, 12, .5); display: none; }
  .app.nav-open .nav-scrim { display: block; }
  .mobile-only { display: revert; }
  .desktop-only { display: none !important; }
  .topbar { padding: 0 8px 0 4px; padding-top: env(safe-area-inset-top, 0px); height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
  .topbar-title { display: block; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-spacer { display: none; }
  .plan-pill { padding: 5px 10px; font-size: 12px; }
  .plan-pill .long { display: none; }
  .content { padding: 18px 16px calc(var(--bottomnav-h) + var(--safe-b) + 28px); }
  .page-header { margin-bottom: 16px; align-items: stretch; }
  .page-header h1 { font-size: 24px; }
  .page-header .page-actions { width: 100%; }
  .page-header .page-actions:not(:has(> :not(.desktop-only))) { display: none; }
  .page-header .page-actions .btn { flex: 1; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; gap: 4px; }
  .stat-label { font-size: 12px; }
  .stat-label .i { display: none; }
  .stat-value { font-size: 21px; }
  .stat-value small { font-size: 12px; }
  .stat-foot { font-size: 11.5px; line-height: 1.35; }
  .stat-hero .stat-value { font-size: 34px; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
  .alert-item, .list-item { padding-left: 16px; padding-right: 16px; }
  .search { max-width: none; }
  .toolbar .count { flex: 1; margin-left: 0; }
  .toolbar select { flex: 1 1 140px; }

  .data-table.compact th, .data-table.compact td { padding: 9px 10px; font-size: 13px; }
  .data-table.compact th { font-size: 11px; }
  /* tabelas viram cartões */
  .table-wrap table { display: none; }
  .data-cards { display: flex; flex-direction: column; }
  .data-card { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
  .data-card:first-child { border-top: 0; }
  .data-card.clickable { cursor: pointer; }
  .data-card.clickable:active { background: var(--surface-2); }
  .data-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
  .data-card-title { font-weight: 700; font-size: 15px; min-width: 0; }
  .data-card-title .secondary { font-weight: 400; font-size: 13px; color: var(--ink-3); }
  .data-card-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 13px; }
  .data-card-fields div { min-width: 0; }
  .data-card-fields > div > span:first-child { color: var(--ink-3); display: block; font-size: 11.5px; }
  .data-card-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }

  /* modais viram bottom sheets */
  .modal-root { padding: 0; place-items: end stretch; }
  .modal, .modal.wide, .modal.narrow { width: 100%; max-height: calc(100dvh - 24px); border-radius: 22px 22px 0 0; animation: slideup .22s cubic-bezier(.2, .8, .2, 1); }
  .sheet-handle { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; }
  .modal-header { padding: 12px 18px 14px; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px calc(12px + var(--safe-b)); border-radius: 0; }
  .modal-footer .btn { flex: 1; min-height: 48px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  .toast-stack { left: 12px; right: 12px; bottom: calc(var(--bottomnav-h) + var(--safe-b) + 12px); }
  .toast { max-width: none; }

  /* barra inferior */
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottomnav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: 11px; font-weight: 600; color: var(--ink-3); border: 0; background: none; text-decoration: none !important; padding: 0;
  }
  .bottom-nav .active { color: var(--link); }
  .bottom-nav .i { width: 22px; height: 22px; }
  .bottom-nav .fab { position: relative; }
  .bottom-nav .fab span.fab-circle { width: 52px; height: 52px; margin-top: -22px; border-radius: 18px; display: grid; place-items: center; background: var(--brand-700); color: #fff; box-shadow: 0 8px 20px -6px rgba(31, 68, 48, .6); }
  .bottom-nav .fab .i { width: 26px; height: 26px; }

  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { place-items: start center; padding: calc(28px + env(safe-area-inset-top, 0px)) 20px 32px; }
  .auth-mobile-brand { display: flex; margin-bottom: 28px; }
  .auth-mobile-brand .brand-name { color: var(--ink); }
  .auth-mobile-brand .brand-name small { color: var(--ink-3); }

  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .quick-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .quick-grid.compact .quick-btn { padding: 10px 4px; font-size: 11.5px; gap: 6px; }
  .quick-grid.compact .qi { width: 36px; height: 36px; }
  .weather-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .weather-days .weather-day:nth-child(n+5) { display: none; }
  .map { height: 340px; }
  .map.tall { height: 420px; }
  .report-doc { padding: 20px 16px; border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; }
  .report-doc .kpis { grid-template-columns: repeat(2, 1fr); }
  .hbar { grid-template-columns: minmax(80px, 38%) 1fr auto; }
  .totp-setup { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .msg { max-width: 92%; }
  .weigh-entry { grid-template-columns: minmax(0, 1fr) 110px; }
  .weigh-entry .btn { grid-column: 1 / -1; }
  .support-bar { font-size: 12.5px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 340px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .data-card-fields { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* ---------------- impressão ---------------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .sidebar, .topbar, .bottom-nav, .toast-stack, .no-print, .offline-bar, .nav-scrim { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .report-doc { border: 0; padding: 0; max-width: none; }
  .report-doc h2 { break-after: avoid; }
  .report-doc tr { break-inside: avoid; }
}
