/* ============================================================================
   Ecoaxis Gestão — design system "Verdant Governance"
   Tokens vindos do design (Stitch): superfícies lavanda-claras, verde-floresta
   como primário, menta como destaque, Plus Jakarta Sans.
   ========================================================================== */

:root {
  --surface: #faf8ff;
  --surface-dim: #d2d9f4;
  --surface-lowest: #ffffff;
  --surface-low: #f2f3ff;
  --surface-container: #eaedff;
  --surface-high: #e2e7ff;
  --surface-highest: #dae2fd;
  --on-surface: #131b2e;
  --on-surface-variant: #404942;
  --outline: #707971;
  --outline-variant: #c0c9c0;

  --primary: #003820;
  --primary-container: #0f5132;
  --on-primary: #ffffff;
  --primary-fixed: #b0f1c7;
  --primary-fixed-dim: #95d4ac;

  --secondary: #006d41;
  --secondary-container: #90f4b7;
  --secondary-fixed: #93f7ba;
  --secondary-fixed-dim: #77da9f;
  --on-secondary-fixed: #002110;
  --on-secondary-fixed-variant: #00522f;

  --tertiary: #003732;
  --tertiary-container: #005049;
  --tertiary-fixed: #89f5e7;
  --tertiary-fixed-dim: #6bd8cb;

  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #93000a;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-400: #fbbf24;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --amber-900: #78350f;
  --emerald-100: #d1fae5;
  --emerald-800: #065f46;
  --sky-100: #e0f2fe;
  --sky-800: #075985;

  --shadow-sm: 0 1px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 24px rgba(19, 27, 46, 0.08);
  --shadow-lg: 0 18px 48px rgba(0, 56, 32, 0.18);

  --r-sm: 0.5rem;
  --r-md: 0.75rem;
  --r-lg: 1rem;
  --r-xl: 1.25rem;

  --sb-w: 18rem;
  --top-h: 4rem;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
}
.ms-14 { font-size: 14px; }
.ms-16 { font-size: 16px; }
.ms-18 { font-size: 18px; }
.ms-22 { font-size: 22px; }
.ms-28 { font-size: 28px; }
.ms-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ── Tipografia ──────────────────────────────────────────────────────────── */
.t-display { font-size: 36px; line-height: 44px; font-weight: 700; letter-spacing: -0.02em; }
.t-headline-lg { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.t-headline-md { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.t-headline-sm { font-size: 18px; line-height: 24px; font-weight: 600; }
.t-title-md { font-size: 16px; line-height: 22px; font-weight: 600; }
.t-title-sm { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: 0.01em; }
.t-body-lg { font-size: 16px; line-height: 24px; }
.t-body-md { font-size: 14px; line-height: 20px; }
.t-body-sm { font-size: 12px; line-height: 16px; letter-spacing: 0.01em; }
.t-label-md { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.t-label-sm { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: 0.03em; }
.t-metric { font-size: 32px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.t-upper { text-transform: uppercase; letter-spacing: 0.08em; }

.t-muted { color: var(--on-surface-variant); }
.t-outline { color: var(--outline); }
.t-primary { color: var(--primary); }
.t-sec { color: var(--secondary); }
.t-warn { color: var(--amber-700); }
.t-err { color: var(--error); }
.t-tert { color: var(--tertiary-container); }
.strong { font-weight: 600; }
.bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ── Layout base ─────────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 0.5rem; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.start { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 0.25rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-xs { gap: 0.25rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.25rem; }
.mt-xs { margin-top: 0.25rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.25rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.stack-md { display: flex; flex-direction: column; gap: 1rem; }
.hide-mobile { display: initial; }
.only-mobile { display: none; }
.divider { height: 1px; background: var(--surface-variant, #dae2fd); width: 100%; }
.vdivider { width: 1px; height: 1.5rem; background: var(--outline-variant); }

/* ── Casca do app: sidebar + topbar ──────────────────────────────────────── */
.sb {
  position: fixed;
  left: 0; top: 0;
  height: 100%;
  width: var(--sb-w);
  background: var(--surface-lowest);
  box-shadow: var(--shadow-sm);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  transition: transform 0.25s ease;
}
.sb-top { display: flex; flex-direction: column; }
.sb-brand {
  height: var(--top-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-low);
}
.sb-brand img { width: 34px; height: 34px; object-fit: contain; }
.sb-brand-name { font-size: 16px; line-height: 20px; font-weight: 700; color: var(--primary); letter-spacing: -0.01em; }
.sb-brand-sub { font-size: 10px; line-height: 12px; font-weight: 600; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.08em; }
.sb-label {
  padding: 0.75rem 1.5rem 0.25rem;
  font-size: 11px; line-height: 14px; font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.sb-nav { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.25rem 1rem; }
.sb-nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem;
  border-radius: var(--r-md);
  color: var(--on-surface-variant);
  font-size: 14px; line-height: 20px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.sb-nav a:hover { background: var(--surface-high); color: var(--on-surface); }
.sb-nav a.active { background: var(--primary-container); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.sb-nav a.sb-sub { padding-left: 2.25rem; font-size: 13px; }
.sb-nav a.sb-sub .material-symbols-outlined { font-size: 18px; }
.sb-foot { padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; background: var(--surface-low); }
.sb-foot .sb-nav { padding: 0; }
.sb-chip {
  padding: 0.5rem 1rem;
  border-radius: var(--r-md);
  background: var(--surface-container);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-size: 11px; line-height: 14px; font-weight: 600; color: var(--on-surface-variant);
}
.sb-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); animation: pulse 2s infinite; }
.sb-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(19, 27, 46, 0.45);
  z-index: 49;
}

.shell { padding-left: var(--sb-w); min-height: 100vh; }

.topbar {
  position: sticky; top: 0;
  height: var(--top-h);
  background: rgba(250, 248, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  z-index: 40;
  padding: 0 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.crumb { display: flex; align-items: center; gap: 0.25rem; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); white-space: nowrap; }
.crumb .cur { color: var(--on-surface); }
.crumb .material-symbols-outlined { font-size: 16px; color: var(--outline); }
.menu-btn { display: none; }

.search {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--surface-lowest);
  padding: 0.35rem 0.9rem;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  color: var(--on-surface-variant);
  width: 17rem;
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 12px; }
.search input::placeholder { color: var(--outline); }
.search .material-symbols-outlined { color: var(--outline); }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--on-surface-variant);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-high); color: var(--on-surface); }
.icon-btn .bell-count {
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--error); color: #fff;
  font-size: 10px; line-height: 16px; font-weight: 700; text-align: center;
}

/* dropdowns com <details> */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-menu {
  position: absolute; right: 0; top: calc(100% + 0.5rem);
  min-width: 15rem;
  background: var(--surface-lowest);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
  z-index: 60;
}
.dd-menu.left { right: auto; left: 0; }
.dd-item {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--on-surface);
  font-size: 13px; font-weight: 500; text-align: left;
  cursor: pointer;
}
.dd-item:hover { background: var(--surface-container); }
.dd-item.active { background: var(--surface-container); color: var(--primary); font-weight: 600; }
.dd-item .material-symbols-outlined { color: var(--on-surface-variant); font-size: 18px; }
.dd-head { padding: 0.5rem 0.75rem 0.25rem; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--on-surface-variant); }
.dd-sep { height: 1px; background: var(--surface-container); margin: 0.35rem 0; }

.switcher {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: var(--surface-lowest);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  font-size: 12px; font-weight: 600;
  max-width: 22rem;
}
.switcher .material-symbols-outlined { font-size: 18px; }
.switcher:hover { background: var(--surface-low); }

.userbox { display: flex; align-items: center; gap: 0.5rem; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.avatar.lg { width: 3rem; height: 3rem; font-size: 16px; }
.userbox .name { font-size: 14px; font-weight: 600; line-height: 1.15; }
.userbox .role { font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); }
.status-pill.live .dot { animation: pulse 2s infinite; }

.content { padding: 1rem 1.25rem 3rem; }

/* bottom nav (mobile) */
.bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(250, 248, 255, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
  z-index: 45;
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom));
}
.bottomnav a, .bottomnav button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0.35rem 0;
  border: 0; background: transparent;
  color: var(--on-surface-variant);
  font-size: 10px; font-weight: 600;
  cursor: pointer;
}
.bottomnav a.active { color: var(--primary); font-weight: 700; }
.bottomnav .material-symbols-outlined { font-size: 22px; }

/* ── Cabeçalho de página ─────────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-head h1 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--on-surface-variant); margin-top: 0.15rem; }
.page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-lowest);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}
.card.tight { padding: 1rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head .lead { display: flex; align-items: center; gap: 0.6rem; }
.card-head h3 { font-size: 16px; line-height: 22px; font-weight: 700; }
.card-head p { font-size: 12px; color: var(--on-surface-variant); }
.card-ico {
  width: 2.5rem; height: 2.5rem; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-container); color: var(--on-primary);
  flex-shrink: 0;
}
.card-ico.sec { background: var(--secondary-container); color: var(--on-secondary-fixed-variant); }
.card-ico.warn { background: var(--amber-100); color: var(--amber-900); }
.card-ico.soft { background: var(--surface-container); color: var(--primary); }
.card-ico.tert { background: var(--tertiary-fixed); color: var(--tertiary); }
.card-foot { padding-top: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 11px; font-weight: 600; color: var(--on-surface-variant); flex-wrap: wrap; }
.link { color: var(--secondary); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.link:hover { text-decoration: underline; }
.link .material-symbols-outlined { font-size: 16px; }

/* Barra de contexto (topo do painel) */
.context-bar {
  background: var(--surface-lowest);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.context-bar .left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ctx-box {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 1rem;
  background: var(--surface-container);
  border-radius: var(--r-sm);
  min-width: 0;
}
.ctx-box .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--on-surface-variant); }
.ctx-box .v { font-size: 14px; font-weight: 600; }
.ctx-box .material-symbols-outlined { color: var(--primary); }
.ctx-box.sec .material-symbols-outlined { color: var(--secondary); }

/* Hero */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  padding: 1.25rem;
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 55%, var(--tertiary) 100%);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; justify-content: space-between;
}
.hero::after {
  content: ""; position: absolute; right: -2.5rem; bottom: -2.5rem;
  width: 12rem; height: 12rem; border-radius: 50%;
  background: rgba(147, 247, 186, 0.12); filter: blur(24px); pointer-events: none;
}
.hero .eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--primary-fixed); opacity: 0.9; }
.hero h2 { font-size: 18px; line-height: 24px; font-weight: 700; margin-top: 0.25rem; }
.hero p { font-size: 12px; line-height: 18px; color: var(--surface-high); }
.hero .vig {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.6rem; border-radius: 999px;
  background: var(--secondary-fixed); color: var(--on-secondary-fixed);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.hero .vig.warn { background: var(--amber-200); color: var(--amber-900); }
.hero .vig.err { background: var(--error-container); color: var(--on-error-container); }
.hero-body { display: flex; align-items: center; gap: 1.25rem; margin: 1rem 0; }
.hero-foot {
  margin: 0 -1.25rem -1.25rem; padding: 0.6rem 1.25rem;
  background: rgba(0, 56, 32, 0.4);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap;
  font-size: 11px; font-weight: 600; color: var(--surface-highest);
}
.hero-foot a { color: var(--secondary-fixed); display: inline-flex; align-items: center; gap: 2px; }
.hero-foot a:hover { text-decoration: underline; }
.hero .check { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem; color: var(--primary-fixed); font-size: 14px; font-weight: 600; }
.ring { position: relative; width: 6rem; height: 6rem; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .lbl .val { font-size: 26px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.ring .lbl .val.-cheio { font-size: 21px; }
.ring .lbl .cap { font-size: 10px; margin-top: 3px; color: var(--primary-fixed); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.kpi { background: var(--surface-lowest); border-radius: var(--r-xl); padding: 1rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: space-between; transition: box-shadow 0.15s; }
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.kpi-head .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--on-surface-variant); }
.kpi-ico { width: 2rem; height: 2rem; border-radius: var(--r-sm); background: var(--surface-container); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.kpi-ico .material-symbols-outlined { font-size: 18px; }
.kpi-ico.sec { color: var(--secondary); }
.kpi-ico.tert { color: var(--tertiary-container); }
.kpi-mid { margin: 0.5rem 0; }
.kpi-val { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.kpi-val .n { font-size: 32px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-val .s { font-size: 12px; font-weight: 600; }
.kpi-sub { font-size: 12px; color: var(--on-surface-variant); margin-top: 0.15rem; }
.kpi-foot { background: var(--surface-low); border-radius: var(--r-sm); padding: 0.25rem 0.5rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.kpi-foot b { font-weight: 700; }

/* Grids do painel */
.grid-hero { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 1rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }

/* ── Badges, chips ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 11px; line-height: 14px; font-weight: 600; white-space: nowrap;
  background: var(--surface-container); color: var(--on-surface-variant);
}
.badge.-ok { background: var(--emerald-100); color: var(--emerald-800); }
.badge.-warn { background: var(--amber-100); color: var(--amber-900); }
.badge.-err { background: var(--error-container); color: var(--on-error-container); }
.badge.-info { background: var(--sky-100); color: var(--sky-800); }
.badge.-muted { background: var(--surface-container); color: var(--on-surface-variant); }
.badge.-mint { background: var(--secondary-fixed); color: var(--on-secondary-fixed); }
.badge.sq { border-radius: 4px; }
.badge .material-symbols-outlined { font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.5rem; border-radius: 4px; background: var(--surface-container); font-size: 11px; font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.tag .material-symbols-outlined { font-size: 15px; color: var(--primary); }
.tag.sec .material-symbols-outlined { color: var(--secondary); }

/* ── Botões ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: 0; border-radius: 999px;
  font-size: 14px; line-height: 20px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
  background: var(--surface-low); color: var(--on-surface);
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-high); }
.btn:active { transform: scale(0.99); }
.btn .material-symbols-outlined { font-size: 18px; }
.btn.-primary { background: var(--primary-container); color: var(--on-primary); box-shadow: 0 6px 16px rgba(15, 81, 50, 0.22); }
.btn.-primary:hover { background: var(--primary); }
.btn.-dark { background: var(--primary); color: var(--on-primary); }
.btn.-dark:hover { background: var(--primary-container); }
.btn.-tonal { background: var(--surface-container); color: var(--on-surface); box-shadow: none; }
.btn.-tonal:hover { background: var(--surface-high); }
.btn.-mint { background: var(--secondary-container); color: var(--on-secondary-fixed-variant); box-shadow: none; }
.btn.-ghost { background: transparent; box-shadow: none; color: var(--on-surface-variant); }
.btn.-ghost:hover { background: var(--surface-container); color: var(--on-surface); }
.btn.-danger { background: var(--error-container); color: var(--on-error-container); box-shadow: none; }
.btn.-danger:hover { background: #ffc4bd; }
.btn.-sm { padding: 0.3rem 0.8rem; font-size: 12px; line-height: 16px; border-radius: var(--r-sm); }
.btn.-sm .material-symbols-outlined { font-size: 16px; }
.btn.-block { width: 100%; }
.btn.-lg { height: 3rem; font-size: 14px; }
.btn.-tonal .t-primary { color: var(--primary); }
.btn:disabled { opacity: 0.6; cursor: default; }
.inline-form { display: inline; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: inline-flex; align-items: center; gap: 2px; padding: 4px; background: var(--surface-container); border-radius: var(--r-md); max-width: 100%; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 0.35rem 0.9rem; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--on-surface-variant);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.tabs a:hover { color: var(--on-surface); }
.tabs a.active { background: var(--surface-lowest); color: var(--primary); box-shadow: var(--shadow-sm); }
.tabs .n { opacity: 0.75; font-weight: 500; }

/* ── Tabelas ─────────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
.tbl { width: 100%; border-collapse: collapse; text-align: left; min-width: 640px; }
.tbl thead tr { background: var(--surface-low); }
.tbl th { padding: 0.5rem 0.75rem; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--on-surface-variant); white-space: nowrap; }
.tbl th:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.tbl th:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.tbl td { padding: 0.9rem 0.75rem; vertical-align: middle; border-bottom: 1px solid var(--surface-low); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(242, 243, 255, 0.6); }
.tbl .title { font-size: 14px; font-weight: 600; }
.tbl .sub { font-size: 12px; color: var(--on-surface-variant); }
.tbl .num { font-weight: 600; }
.tbl td.actions { text-align: right; white-space: nowrap; }

/* ── Itens (cards de lista) ──────────────────────────────────────────────── */
.item {
  background: var(--surface-low);
  border-radius: var(--r-md);
  padding: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  transition: background 0.15s;
}
.item:hover { background: var(--surface-container); }
.item.-done { background: var(--surface-lowest); border: 1px solid var(--surface-container); }
.item-lead { display: flex; align-items: flex-start; gap: 1rem; min-width: 0; flex: 1; }
.item-ico { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.item-ico.warn { background: var(--amber-200); color: var(--amber-900); }
.item-ico.err { background: var(--error-container); color: var(--on-error-container); }
.item-ico.info { background: var(--sky-100); color: var(--sky-800); }
.item-ico.ok { background: var(--emerald-100); color: var(--emerald-800); }
.item-ico.muted { background: var(--surface-container); color: var(--on-surface-variant); }
.item-body { min-width: 0; flex: 1; }
.item-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.item h4 { font-size: 14px; line-height: 20px; font-weight: 700; }
.item h4 a:hover { text-decoration: underline; }
.item p { font-size: 12px; color: var(--on-surface-variant); margin-top: 0.15rem; }
.item-tags { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }
.item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; flex-shrink: 0; }
.prazo-tag { display: inline-flex; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 11px; font-weight: 700; }
.prazo-tag.warn { background: rgba(253, 230, 138, 0.8); color: #451a03; }
.prazo-tag.err { background: var(--error-container); color: var(--on-error-container); }
.prazo-tag.info { background: var(--sky-100); color: var(--sky-800); }
.prazo-tag.ok { background: var(--emerald-100); color: var(--emerald-800); }

/* mini-cards (checklists/próximos) */
.mini { padding: 0.75rem; border-radius: var(--r-md); background: var(--surface-low); display: flex; flex-direction: column; gap: 0.3rem; }
.mini .when { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--secondary); }
.mini .when.err { color: var(--error); }
.mini .title { font-size: 14px; font-weight: 600; }
.mini p { font-size: 12px; color: var(--on-surface-variant); }

/* central de arquivos */
.hub { padding: 0.75rem; background: var(--surface-container); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 4px; transition: background 0.15s; }
.hub:hover { background: var(--surface-high); }
.hub .t { font-size: 14px; font-weight: 600; }
.hub .s { font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.hub .material-symbols-outlined { font-size: 22px; color: var(--primary); }
.hub.sec .material-symbols-outlined { color: var(--secondary); }
.hub.tert .material-symbols-outlined { color: var(--tertiary); }

/* ── Gráfico de barras (cronograma) ──────────────────────────────────────── */
.bars-box { background: var(--surface-low); border-radius: var(--r-md); padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.bars-box .head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.bars { height: 7rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5rem; padding-top: 0.25rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-col .v { font-size: 10px; font-weight: 600; color: var(--on-surface-variant); }
.bar-col .bar { width: 100%; border-radius: 6px 6px 0 0; background: var(--primary-fixed-dim); min-height: 4px; transition: opacity 0.15s; }
.bar-col .bar:hover { opacity: 0.8; }
.bar-col .l { font-size: 11px; font-weight: 500; color: var(--on-surface-variant); }
.bar-col.now .bar { background: var(--amber-400); }
.bar-col.now .v, .bar-col.now .l { color: var(--amber-700); font-weight: 700; }
.bar-col.peak .bar { background: var(--primary-container); }
.bar-col.peak .v, .bar-col.peak .l { color: var(--primary); font-weight: 700; }

/* ── Formulários ─────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.field label .req { color: var(--error); }
.field .help { font-size: 11px; color: var(--on-surface-variant); }
.field .err { font-size: 11px; font-weight: 600; color: var(--error); }
.field .err:empty { display: none; }
.input, .select, .textarea {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-low);
  outline: none;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus { background: var(--surface-lowest); border-color: var(--primary-fixed-dim); box-shadow: 0 0 0 3px rgba(149, 212, 172, 0.35); }
.input.input-validation-error, .select.input-validation-error, .textarea.input-validation-error { border-color: var(--error); }
.textarea { height: auto; min-height: 6rem; padding: 0.75rem 0.9rem; resize: vertical; line-height: 20px; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='%23707971'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.25rem; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .material-symbols-outlined { position: absolute; left: 0.85rem; color: var(--outline); pointer-events: none; }
.input-wrap .input { padding-left: 2.7rem; }
.input-wrap .toggle { position: absolute; right: 0.5rem; border: 0; background: transparent; color: var(--outline); cursor: pointer; padding: 0.3rem; border-radius: var(--r-sm); display: inline-flex; }
.input-wrap .toggle:hover { color: var(--on-surface); }
.input-wrap .toggle .material-symbols-outlined { position: static; }
.check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; user-select: none; font-size: 12px; color: var(--on-surface-variant); }
.check input { width: 1rem; height: 1rem; accent-color: var(--primary); cursor: pointer; }
.file {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px dashed var(--outline-variant);
  border-radius: var(--r-md);
  background: var(--surface-low);
  cursor: pointer;
  color: var(--on-surface-variant); font-size: 12px;
}
.file:hover { border-color: var(--primary-fixed-dim); background: var(--surface-lowest); }
.file input { display: none; }
.file .material-symbols-outlined { color: var(--primary); font-size: 24px; }
.file .fname { font-weight: 600; color: var(--on-surface); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.25rem; }
.validation-summary-errors { background: var(--error-container); color: var(--on-error-container); border-radius: var(--r-md); padding: 0.75rem 1rem; font-size: 13px; font-weight: 500; margin-bottom: 1rem; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }

/* radio-pills da execução de checklist */
.radios { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-container); border-radius: var(--r-md); flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.7rem; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; color: var(--on-surface-variant); cursor: pointer; }
.radios input { display: none; }
.radios label:has(input:checked) { background: var(--surface-lowest); box-shadow: var(--shadow-sm); color: var(--on-surface); }
.radios label.ok:has(input:checked) { color: var(--emerald-800); }
.radios label.nc:has(input:checked) { color: var(--on-error-container); }

/* ── Flash / alertas / vazio ─────────────────────────────────────────────── */
.flash { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1rem; border-radius: var(--r-md); font-size: 13px; font-weight: 500; margin-bottom: 1rem; }
.flash.-ok { background: var(--emerald-100); color: var(--emerald-800); }
.flash.-erro { background: var(--error-container); color: var(--on-error-container); }
.flash.-aviso { background: var(--amber-100); color: var(--amber-900); }
.flash .close { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; display: inline-flex; }
.notice { display: flex; gap: 0.75rem; padding: 0.9rem 1rem; border-radius: var(--r-md); background: var(--surface-container); font-size: 13px; }
.notice .material-symbols-outlined { color: var(--primary); }
.notice.warn { background: var(--amber-50); }
.notice.warn .material-symbols-outlined { color: var(--amber-700); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--on-surface-variant); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.empty .material-symbols-outlined { font-size: 40px; color: var(--outline-variant); }
.empty h4 { font-size: 15px; font-weight: 600; color: var(--on-surface); }
.empty p { font-size: 13px; max-width: 28rem; }

/* progresso simples */
.progress { height: 6px; border-radius: 999px; background: var(--surface-container); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--secondary); }

/* detalhes: lista de definição */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.75rem 1.25rem; }
.dl .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--on-surface-variant); }
.dl .v { font-size: 14px; font-weight: 500; margin-top: 2px; word-break: break-word; }
.pre { white-space: pre-wrap; }

/* ── Autenticação ────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card {
  width: 100%; max-width: 72rem;
  background: var(--surface-lowest);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 46rem;
}
.auth-left {
  position: relative; overflow: hidden;
  padding: 3rem;
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 55%, var(--tertiary) 100%);
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
}
.auth-left::before { content: ""; position: absolute; right: -6rem; bottom: -6rem; width: 24rem; height: 24rem; border-radius: 50%; background: rgba(107, 216, 203, 0.10); filter: blur(48px); pointer-events: none; }
.auth-left::after { content: ""; position: absolute; left: -4rem; top: -4rem; width: 20rem; height: 20rem; border-radius: 50%; background: rgba(0, 109, 65, 0.15); filter: blur(32px); pointer-events: none; }
.auth-left > * { position: relative; z-index: 1; }
.glass { background: rgba(255, 255, 255, 0.10); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: var(--r-md); }
.auth-brand { display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; }
.auth-brand img { width: 34px; height: 34px; object-fit: contain; }
.auth-brand .n { font-size: 16px; font-weight: 700; }
.auth-brand .s { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--primary-fixed); }
.auth-left h1 { font-size: 36px; line-height: 44px; font-weight: 700; letter-spacing: -0.02em; max-width: 30rem; }
.auth-left .lead { font-size: 16px; line-height: 26px; color: rgba(176, 241, 199, 0.85); max-width: 28rem; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.75rem; border-radius: 999px; background: rgba(255, 255, 255, 0.10); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--primary-fixed); }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.auth-feat { padding: 1rem; }
.auth-feat .k { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(176, 241, 199, 0.8); margin-bottom: 0.5rem; }
.auth-feat .v { font-size: 20px; line-height: 26px; font-weight: 700; }
.auth-feat p { font-size: 12px; line-height: 16px; color: rgba(176, 241, 199, 0.7); margin-top: 0.4rem; }
.auth-note { padding: 1rem; display: flex; gap: 0.75rem; align-items: flex-start; font-size: 12px; line-height: 18px; }
.auth-note strong { color: var(--secondary-fixed); }
.auth-note .material-symbols-outlined { color: var(--secondary-fixed); font-size: 22px; }
.auth-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 11px; font-weight: 600; color: rgba(176, 241, 199, 0.7); }
.auth-footer span { display: inline-flex; align-items: center; gap: 0.3rem; }
.auth-footer .material-symbols-outlined { font-size: 16px; color: var(--tertiary-fixed); }
.auth-right { padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.auth-form { width: 100%; max-width: 26rem; margin: 0 auto; }
.auth-form h2 { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.auth-form .sub { color: var(--on-surface-variant); margin-top: 0.5rem; line-height: 22px; }
.auth-form .field { margin-top: 1rem; }
.auth-form .input { height: 3rem; background: var(--surface-lowest); box-shadow: var(--shadow-sm); }
.auth-form .input:focus { background: var(--surface-low); }
.auth-sep { position: relative; text-align: center; margin: 1.5rem 0; }
.auth-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--surface-container); }
.auth-sep span { position: relative; padding: 0 1rem; background: var(--surface-lowest); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--outline); }
.auth-help { width: 100%; max-width: 26rem; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 0.35rem; font-size: 12px; color: var(--on-surface-variant); }
.auth-help .ver { font-size: 11px; font-weight: 600; color: var(--outline); }
.auth-mobile-brand { display: none; }

/* ── Impressão (relatório) ───────────────────────────────────────────────── */
.print-only { display: none; }
@media print {
  .sb, .topbar, .bottomnav, .no-print, .flash { display: none !important; }
  .shell { padding-left: 0; }
  .content { padding: 0; }
  body { background: #fff; font-size: 12px; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .print-only { display: block; }
  .tbl { min-width: 0; }
  .tbl-wrap { margin: 0; padding: 0; overflow: visible; }
}

/* ── Animações ───────────────────────────────────────────────────────────── */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── Responsivo ──────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-hero { grid-template-columns: minmax(0, 1fr); }
  .search { width: 12rem; }
  .userbox .name, .userbox .role { display: none; }
}

@media (max-width: 1024px) {
  :root { --sb-w: 0px; }
  .sb { width: 18rem; transform: translateX(-100%); box-shadow: none; }
  body.sb-open .sb { transform: translateX(0); box-shadow: var(--shadow-lg); }
  body.sb-open .sb-backdrop { display: block; }
  .shell { padding-left: 0; }
  .menu-btn { display: inline-flex; }
  .crumb .pre { display: none; }
  .search { display: none; }
  .switcher-top { display: none; }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .bottomnav { display: flex; }
  .content { padding-bottom: 5.5rem; }
  .hide-mobile { display: none !important; }
  .only-mobile { display: initial; }
  .auth-card { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-left { display: none; }
  .auth-right { padding: 2rem 1.5rem; }
  .auth-mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
  .auth-mobile-brand img { width: 48px; height: 48px; }
  .auth-mobile-brand .n { font-size: 20px; font-weight: 700; color: var(--primary); }
}

@media (max-width: 640px) {
  .content { padding: 0.75rem 1rem 5.5rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .item { flex-direction: column; align-items: stretch; }
  .item-actions { flex-direction: row; align-items: center; justify-content: flex-end; }
  .page-head h1 { font-size: 20px; line-height: 28px; }
  .card { padding: 1rem; border-radius: var(--r-md); }
  .tbl-wrap { margin: 0 -1rem; padding: 0 1rem; }
  .context-bar { padding: 0.75rem; }
  .ctx-box { width: 100%; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .hero-body { flex-direction: row; }
  .auth-feats { grid-template-columns: minmax(0, 1fr); }
  .tabs { width: 100%; }
}

/* ── Login em telas estreitas: nada pode estourar a largura ──────────────── */
html, body { overflow-x: hidden; }
@media (max-width: 640px) {
  .auth-page { padding: 0.75rem; }
  .auth-card { min-height: 0; border-radius: var(--r-md); }
  .auth-right { padding: 1.5rem 1rem; }
  .auth-form, .auth-help { max-width: 100%; }
  .auth-form .row.between { flex-wrap: wrap; gap: 0.35rem; }
  .auth-form .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-form .btn { white-space: normal; }
  .auth-help span { display: block; }
}


/* ============================================================================
   Gestão modelo Ambisis — componentes comuns (2026-10)
   ========================================================================== */

/* menu lateral: grupo "Relação com órgãos" */
.sb-nav .sb-grupo > summary { list-style: none; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 1rem; border-radius: var(--r-md); color: var(--on-surface-variant); font-size: 14px; font-weight: 600; cursor: pointer; }
.sb-nav .sb-grupo > summary::-webkit-details-marker { display: none; }
.sb-nav .sb-grupo > summary:hover { background: var(--surface-high); color: var(--on-surface); }
.sb-nav .sb-grupo > summary.active { color: var(--primary); }
.sb-nav .sb-grupo > summary .seta { margin-left: auto; transition: transform .2s; }
.sb-nav .sb-grupo[open] > summary .seta { transform: rotate(180deg); }
.sb-nav .sb-grupo > a { padding-left: 2.4rem; font-weight: 500; }
.sb-top { overflow-y: auto; }

/* barra superior: atalhos e contadores */
.atalhos { display: flex; align-items: center; gap: 0.4rem; }
.atalhos .dd > summary.btn { box-shadow: none; }
.contador { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.6rem; border-radius: var(--r-sm); background: var(--surface-container); font-size: 12px; font-weight: 600; color: var(--on-surface-variant); }
.contador:hover { background: var(--surface-high); color: var(--on-surface); }
.contador b { color: var(--primary); }
.icon-btn .bell-count.-sec { background: var(--secondary); }
.icon-btn.-fill { background: var(--primary-container); color: var(--on-primary); }
.icon-btn.-fill:hover { background: var(--primary); color: var(--on-primary); }

/* painel de prazos */
.painel-prazos { width: 25rem; max-height: 70vh; overflow-y: auto; padding: 0.75rem; }
.painel-carregando { padding: 1rem; display: flex; align-items: center; gap: 0.5rem; color: var(--on-surface-variant); font-size: 13px; }
.pp-bloco { margin-bottom: 0.75rem; }
.pp-titulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.35rem; }
.pp-bloco.-err .pp-titulo { color: var(--error); }
.pp-bloco.-warn .pp-titulo { color: var(--amber-700); }
.pp-vazio { font-size: 12px; color: var(--outline); }
.pp-grupo { background: var(--surface-low); border-radius: var(--r-sm); padding: 0.4rem 0.6rem; margin-bottom: 0.35rem; }
.pp-grupo-nome { font-size: 11px; font-weight: 600; color: var(--on-surface-variant); margin-bottom: 0.15rem; }
.pp-item { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.2rem 0; font-size: 12px; font-weight: 600; }
.pp-item:hover { color: var(--primary); }
.pp-data { color: var(--on-surface-variant); font-weight: 500; white-space: nowrap; }
.pp-mais { font-size: 11px; color: var(--outline); }

/* cabeçalho de página com breadcrumb e ações à direita */
.page-head .crumb-pagina { display: flex; align-items: center; gap: 0.35rem; font-size: 20px; font-weight: 700; flex-wrap: wrap; }
.page-head .crumb-pagina a { color: var(--secondary); }
.page-head .crumb-pagina .sep { color: var(--outline); font-weight: 400; }
.page-head .selos-titulo { display: inline-flex; gap: 0.35rem; align-items: center; }
.status-botoes { display: inline-flex; border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.status-botoes button { border: 0; padding: 0.4rem 0.8rem; font-size: 12px; font-weight: 600; cursor: pointer; background: var(--surface-container); color: var(--on-surface-variant); font-family: inherit; }
.status-botoes button:hover { background: var(--surface-high); }
.status-botoes button.on { background: var(--primary-container); color: var(--on-primary); }
.status-botoes button.on.-warn { background: var(--amber-400); color: var(--amber-900); }
.status-botoes button.on.-info { background: var(--sky-800); color: #fff; }
.status-botoes button.on.-muted { background: var(--on-surface-variant); color: #fff; }

/* filtros das listas */
.filtros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem 1rem; margin-bottom: 1rem; }
.filtros .field label { font-size: 11px; }
.filtros .acoes { display: flex; align-items: flex-end; gap: 0.5rem; }
.lista-barra { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.exibindo { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); }
.select.-xs, .input.-xs { height: 2rem; padding: 0 1.8rem 0 0.6rem; width: auto; font-size: 12px; border-radius: var(--r-sm); background-position: right 0.3rem center; }
.search.-inline { box-shadow: none; background: var(--surface-low); width: 16rem; }
.tbl th a { color: inherit; display: inline-flex; align-items: center; gap: 2px; }
.tbl th a .material-symbols-outlined { font-size: 14px; }
.tbl td .linha2 { display: block; font-size: 11px; color: var(--on-surface-variant); }
.tbl td.chk, .tbl th.chk { width: 2rem; }
.tbl-acoes-massa { display: none; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: var(--surface-container); border-radius: var(--r-sm); margin-bottom: 0.5rem; font-size: 12px; font-weight: 600; }
.tbl-acoes-massa.on { display: flex; }
.total-linha td { font-weight: 700; background: var(--surface-low); }

/* paginação */
.paginacao { display: flex; align-items: center; gap: 0.25rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.paginacao .pg { min-width: 2rem; height: 2rem; padding: 0 0.5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; color: var(--on-surface-variant); background: var(--surface-low); }
.paginacao .pg:hover { background: var(--surface-high); }
.paginacao .pg.active { background: var(--primary-container); color: var(--on-primary); }
.paginacao .pg.disabled { opacity: 0.4; pointer-events: none; }
.paginacao .pg-gap { padding: 0 0.25rem; color: var(--outline); }
.paginacao .pg-info { margin-left: 0.5rem; font-size: 12px; color: var(--on-surface-variant); }

/* selos de prazo (RN-02) */
.selos { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.selos.-linha { flex-direction: row; flex-wrap: wrap; }
.selo { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 4px; font-size: 10.5px; line-height: 16px; font-weight: 700; white-space: nowrap; }
.selo.-ok { background: #1f8a4c; color: #fff; }
.selo.-warn { background: #e8a10c; color: #3d2700; }
.selo.-err { background: #c62828; color: #fff; }
.selo.-done { background: var(--emerald-100); color: var(--emerald-800); }
.selo.-info { background: var(--sky-100); color: var(--sky-800); }
.selo.-muted { background: #8a918c; color: #fff; }
.legenda-selos { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 11px; color: var(--on-surface-variant); align-items: center; }

/* etiquetas */
.etiquetas { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.etiqueta { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--cor, #0f5132) 14%, white); color: color-mix(in srgb, var(--cor, #0f5132) 80%, black); border: 1px solid color-mix(in srgb, var(--cor, #0f5132) 35%, white); }

/* formulário de registro: abas, colunas, painel de alertas à direita */
.registro { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1.25rem; align-items: start; }
.registro.-cheio { grid-template-columns: minmax(0, 1fr); }
.registro-lateral { position: sticky; top: calc(var(--top-h) + 1rem); display: flex; flex-direction: column; gap: 1rem; }
.registro-lateral .card h4 { font-size: 13px; font-weight: 700; color: var(--on-surface-variant); text-align: center; margin-bottom: 0.5rem; }
.abas-registro { display: flex; gap: 2px; border-bottom: 2px solid var(--surface-container); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.abas-registro::-webkit-scrollbar { display: none; }
.abas-registro a, .abas-registro button { padding: 0.6rem 1rem; border: 0; background: transparent; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--on-surface-variant); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.35rem; }
.abas-registro a:hover, .abas-registro button:hover { color: var(--on-surface); }
.abas-registro .active { color: var(--primary); border-bottom-color: var(--primary); }
.abas-registro .n { font-size: 11px; background: var(--surface-container); border-radius: 999px; padding: 0 6px; }
.aba-painel { display: none; }
.aba-painel.on { display: block; }
.form-grid.\-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.\-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-secao { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin: 1.25rem 0 0.75rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--surface-container); }
.field .ajuda { font-size: 15px; color: var(--outline); cursor: help; vertical-align: -2px; }
.somente-leitura { background: var(--surface-low); border-radius: var(--r-md); padding: 0.75rem 1rem; }
.somente-leitura .input { background: var(--surface-lowest); }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 13px; font-weight: 600; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 2.2rem; height: 1.25rem; border-radius: 999px; background: var(--outline-variant); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.25rem - 4px); height: calc(1.25rem - 4px); border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--secondary); }
.switch input:checked::after { transform: translateX(0.95rem); }
.seletor-linha { display: flex; gap: 0.35rem; align-items: stretch; }
.seletor-linha > select, .seletor-linha > .ts-wrapper { flex: 1; min-width: 0; }
.seletor-linha .icon-btn { height: 2.75rem; width: 2.75rem; border-radius: var(--r-md); background: var(--surface-container); flex-shrink: 0; }
.seletor-linha .icon-btn.-fill { background: var(--primary-container); color: var(--on-primary); }

/* rodapé fixo de salvamento */
.form-rodape { position: sticky; bottom: 0; z-index: 30; margin: 1.25rem -1.25rem -3rem; padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom)); background: rgba(250, 248, 255, 0.92); backdrop-filter: blur(12px); box-shadow: 0 -2px 12px rgba(0,0,0,.05); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.editado-por { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 12px; color: var(--on-surface-variant); flex-wrap: wrap; }

/* painel de alertas (medidor) */
.alerta-campo { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.5rem 0; }
.alerta-campo + .alerta-campo { border-top: 1px solid var(--surface-container); padding-top: 1rem; }
.alerta-rotulo { font-size: 12px; font-weight: 700; text-align: center; }
.alerta-sub { display: block; font-weight: 500; color: var(--on-surface-variant); font-size: 11px; }
.alerta-corpo { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; width: 100%; }
.gauge { position: relative; width: 5.5rem; height: 5.5rem; }
.gauge svg { width: 100%; height: 100%; }
.gauge .g-bg { fill: none; stroke: var(--surface-container); stroke-width: 3.4; }
.gauge .g-fg { fill: none; stroke: var(--primary-container); stroke-width: 3.4; stroke-linecap: round; transition: stroke-dasharray .3s; }
.gauge-input { position: absolute; inset: 0; margin: auto; width: 3.6rem; height: 2rem; border: 0; background: transparent; text-align: center; font-size: 20px; font-weight: 700; color: var(--primary); font-family: inherit; -moz-appearance: textfield; }
.gauge-input::-webkit-outer-spin-button, .gauge-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gauge-input:focus { outline: 2px solid var(--primary-fixed-dim); border-radius: var(--r-sm); }
.alerta-corpo .field { width: 100%; }
.alerta-corpo .field label { text-align: center; font-size: 11px; }
.alerta-inline { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.alerta-inline .alerta-campo { flex-direction: row; padding: 0; border: 0; }
.alerta-inline .alerta-corpo { flex-direction: row; }
.alerta-inline .gauge { width: 3.6rem; height: 3.6rem; }
.alerta-inline .gauge-input { font-size: 15px; width: 2.8rem; }

/* anexos */
.arquivos { display: flex; flex-direction: column; gap: 0.6rem; }
.arquivos-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.arquivos-head h4 { font-size: 14px; font-weight: 700; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 1rem; border: 1.5px dashed var(--outline-variant); border-radius: var(--r-md); background: var(--surface-low); cursor: pointer; text-align: center; font-size: 13px; color: var(--on-surface-variant); transition: border-color .15s, background .15s; position: relative; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .material-symbols-outlined { font-size: 28px; color: var(--primary); }
.dropzone.over, .dropzone:hover { border-color: var(--primary-fixed-dim); background: var(--surface-lowest); }
.dropzone.enviando { opacity: 0.6; pointer-events: none; }
.arquivos-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.arquivos-lista li { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: var(--r-sm); background: var(--surface-low); }
.arquivos-lista .nome { font-weight: 600; font-size: 13px; word-break: break-all; }
.arquivos-lista .nome:hover { text-decoration: underline; }
.arquivos-lista .meta, .arquivos-fotos .meta { display: block; font-size: 11px; color: var(--on-surface-variant); }
.arquivos-fotos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.6rem; }
.arquivos-fotos li { background: var(--surface-low); border-radius: var(--r-sm); padding: 0.4rem; display: flex; flex-direction: column; gap: 0.3rem; position: relative; }
.arquivos-fotos li > .material-symbols-outlined { font-size: 40px; align-self: center; margin: 1rem 0; }
.arquivos-fotos .foto img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.arquivos-fotos .nome { font-size: 11px; font-weight: 600; word-break: break-all; }
.arquivos-fotos form { position: absolute; top: 0.4rem; right: 0.4rem; }
.arquivos-fotos form .icon-btn { background: rgba(255,255,255,.9); }

/* histórico */
.historico ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--surface-container); }
.historico li { position: relative; padding: 0 0 0.75rem 1rem; display: flex; flex-direction: column; gap: 1px; }
.historico li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary-fixed-dim); border: 2px solid var(--surface-lowest); }
.historico .h-data { font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.historico .h-texto { font-size: 13px; }
.historico .h-autor { font-size: 11px; color: var(--outline); }

/* itens expansíveis (condicionantes, entregas, controles) */
.bloco { background: var(--surface-low); border-radius: var(--r-md); margin-bottom: 0.6rem; }
.bloco > summary, .bloco-cab { list-style: none; display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; cursor: pointer; flex-wrap: wrap; }
.bloco > summary::-webkit-details-marker { display: none; }
.bloco-cab .titulo, .bloco > summary .titulo { font-weight: 700; font-size: 14px; }
.bloco > summary .seta { margin-left: auto; transition: transform .2s; color: var(--outline); }
.bloco[open] > summary .seta { transform: rotate(180deg); }
.bloco-corpo { padding: 0 0.9rem 0.9rem; }
.bloco.-sub { background: var(--surface-lowest); border: 1px solid var(--surface-container); }
.bloco.-cancelado { opacity: 0.6; }
.alca { cursor: grab; color: var(--outline); }
.massa-barra { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem; background: var(--surface-container); border-radius: var(--r-md); margin-bottom: 0.6rem; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.massa-barra .links { display: flex; gap: 0.75rem; font-size: 12px; }
.massa-barra .links a, .massa-barra .links button { color: var(--secondary); cursor: pointer; background: none; border: 0; font: inherit; font-weight: 600; padding: 0; }

/* modal (dialog) */
dialog.modal { border: 0; border-radius: var(--r-lg); padding: 0; width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--shadow-lg); color: var(--on-surface); }
dialog.modal.-lg { width: min(64rem, calc(100vw - 2rem)); }
dialog.modal::backdrop { background: rgba(19, 27, 46, 0.45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--surface-container); }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 1.25rem; overflow-y: auto; max-height: calc(100vh - 12rem); }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.9rem 1.25rem; border-top: 1px solid var(--surface-container); }

/* toasts (RF-GLB-09) */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(26rem, calc(100vw - 2rem)); }
.toast { display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1rem; border-radius: var(--r-md); box-shadow: var(--shadow-md); font-size: 13px; font-weight: 500; animation: toast-in .25s ease; }
.toast.-ok { background: var(--emerald-800); color: #fff; }
.toast.-erro { background: var(--error); color: #fff; }
.toast.-aviso { background: var(--amber-200); color: var(--amber-900); }
.toast.-info { background: var(--sky-800); color: #fff; }
.toast .close { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; display: inline-flex; }
.toast.saindo { opacity: 0; transform: translateY(8px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* aviso de IA (revisão humana, RNF-08) */
.aviso-ia { display: flex; gap: 0.6rem; padding: 0.75rem 1rem; border-radius: var(--r-md); background: #f3efff; color: #3b2a7a; font-size: 12.5px; }
.aviso-ia .material-symbols-outlined { color: #6d4bd8; }
.btn.-ia { background: #6d4bd8; color: #fff; box-shadow: none; }
.btn.-ia:hover { background: #5a3cc0; }

/* Tom Select no tema (o wrapper herda a classe .select/.input do <select>: zera esses estilos) */
.ts-wrapper.select, .ts-wrapper.input { height: auto; padding: 0; background: none !important; border: 0; box-shadow: none; appearance: none; }
/* o Tom Select usa a classe .item nos itens escolhidos; neutraliza o .item (cartão) do design system */
.ts-wrapper .ts-control > .item { padding: 0; background: none; border-radius: 0; display: inline-flex; align-items: center; gap: 0; justify-content: flex-start; transition: none; }
.ts-wrapper .ts-control > .item:hover { background: none; }
.ts-wrapper.multi .ts-control > .item { padding: 1px 8px; background: var(--secondary-fixed); border-radius: 999px; }
.ts-wrapper.select.-xs .ts-control { min-height: 2rem; padding: 0.2rem 0.6rem; font-size: 12px; }
.ts-wrapper.single .ts-control, .ts-wrapper.multi .ts-control { min-height: 2.75rem; border: 1px solid transparent; border-radius: var(--r-md); background: var(--surface-low) !important; box-shadow: none; padding: 0.45rem 0.9rem; font-size: 14px; }
.ts-wrapper.focus .ts-control { background: var(--surface-lowest) !important; border-color: var(--primary-fixed-dim); box-shadow: 0 0 0 3px rgba(149, 212, 172, 0.35); }
.ts-wrapper.multi .ts-control > div { background: var(--secondary-fixed); color: var(--on-secondary-fixed); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.ts-dropdown { border-radius: var(--r-md); box-shadow: var(--shadow-md); border: 0; font-size: 13px; }
.ts-dropdown .active { background: var(--surface-container); color: var(--on-surface); }
.ts-dropdown .create { color: var(--secondary); font-weight: 600; }
.ts-wrapper.disabled .ts-control { opacity: 0.7; }
.filtros .ts-wrapper .ts-control { min-height: 2.4rem; padding: 0.3rem 0.7rem; }

/* editor rico (Quill) */
.rico { background: var(--surface-lowest); border-radius: var(--r-md); }
.rico .ql-toolbar.ql-snow { border: 1px solid var(--surface-container); border-radius: var(--r-md) var(--r-md) 0 0; background: var(--surface-low); }
/* o Quill põe height:100% no container; somado à barra, transbordava sobre o campo seguinte */
.rico .ql-container.ql-snow { height: auto; border: 1px solid var(--surface-container); border-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); font-family: inherit; font-size: 14px; }
.rico .ql-editor { min-height: 8rem; }
.rico.-curto .ql-editor { min-height: 5rem; }
.conteudo-rico p { margin: 0 0 0.5rem; }
.conteudo-rico ul, .conteudo-rico ol { margin: 0 0 0.5rem; padding-left: 1.25rem; }

/* KPI compacto */
.kpis.-compacto { grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.kpi .mes { font-size: 11px; font-weight: 600; color: var(--secondary); }

@media (max-width: 1280px) {
  .registro { grid-template-columns: minmax(0, 1fr); }
  .registro-lateral { position: static; flex-direction: row; flex-wrap: wrap; }
  .registro-lateral > * { flex: 1 1 14rem; }
  .filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .filtros { grid-template-columns: minmax(0, 1fr); }
  .form-grid.\-3, .form-grid.\-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .painel-prazos { width: calc(100vw - 2rem); }
  .form-rodape { margin: 1rem -1rem -5.5rem; }
  .search.-inline { width: 100%; }
}
@media print {
  .form-rodape, .toasts, .filtros, .lista-barra, .paginacao, .atalhos { display: none !important; }
}
