/* CompreCerto — design system ConservPro (tokens verbatim) */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('../fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  --brand: oklch(63% .17 245); --brand-deep: oklch(59% .15 237); --brand-deep-text: oklch(55% .15 237);
  --mint: oklch(75% .16 163); --ice: oklch(97% .018 240); --navy: oklch(28% .05 255);
  --background: var(--ice); --foreground: var(--navy);
  --card: oklch(100% 0 0); --card-foreground: var(--navy);
  --primary: var(--brand); --primary-foreground: oklch(100% 0 0);
  --secondary: oklch(95.5% .025 238); --secondary-foreground: var(--navy);
  --muted: oklch(95.5% .014 245); --muted-foreground: oklch(53% .035 253);
  --accent: oklch(94% .038 240); --accent-foreground: var(--brand-deep-text);
  --destructive: oklch(57.7% .245 27.325); --destructive-text: oklch(52% .245 27.325); --destructive-foreground: oklch(98.5% 0 0);
  --border: oklch(92% .025 245); --input: oklch(92% .025 245); --ring: var(--brand);
  --radius: .75rem; --radius-sm: .5rem; --radius-md: .625rem; --radius-lg: .75rem; --radius-xl: 1rem; --radius-2xl: 1.5rem;
  --slate-50:#f8fafc; --slate-200:#e2e8f0; --slate-400:#94a3b8; --slate-500:#64748b; --slate-700:#334155;
  --amber-50:#fffbeb; --amber-200:#fde68a; --amber-400:#fbbf24; --amber-600:#d97706; --amber-700:#b45309;
  --emerald-50:#ecfdf5; --emerald-200:#a7f3d0; --emerald-600:#059669; --emerald-700:#047857;
  --blue-50:#eff6ff; --blue-200:#bfdbfe; --blue-700:#1d4ed8;
  --red-50:#fef2f2; --red-200:#fecaca; --red-700:#b91c1c;
  --violet-50:#f5f3ff; --violet-200:#ddd6fe; --violet-700:#6d28d9;
  --ff-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 4.25rem; --side-w: 16rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: oklch(70% .15 241); --primary-foreground: oklch(15% .035 255);
    --background: oklch(16% .035 255); --foreground: oklch(96% .01 245); --navy: oklch(96% .01 245);
    --card: oklch(21% .035 255); --card-foreground: oklch(96% .01 245);
    --secondary: oklch(26% .04 255); --muted: oklch(25% .03 255); --muted-foreground: oklch(73% .025 245);
    --accent: oklch(28% .05 245); --accent-foreground: oklch(96% .01 245); --brand-deep-text: oklch(75% .12 237);
    --destructive: oklch(70.4% .191 22.216); --destructive-text: oklch(70.4% .191 22.216);
    --border: oklch(100% 0 0/.12); --input: oklch(100% 0 0/.16); --ring: oklch(70% .15 241);
    --slate-50:#16202f; --slate-200:#26374d; --slate-400:#7c8ba0; --slate-500:#94a3b8; --slate-700:#cbd5e1;
    --amber-50:#2c2210; --amber-200:#4d3a12; --amber-600:#e8b15b; --amber-700:#e8b15b;
    --emerald-50:#0d2620; --emerald-200:#155e46; --emerald-600:#34d399; --emerald-700:#34d399;
    --blue-50:#0e1f3d; --blue-200:#1f3a66; --blue-700:#6b99ff;
    --red-50:#2c1010; --red-200:#5c1c1c; --red-700:#ff6467;
    --violet-50:#1f1636; --violet-200:#3b2a66; --violet-700:#b9a5ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--ff-sans); font-size: 15px; line-height: 1.55; color: var(--foreground); background: var(--background); font-weight: 400; }
a { color: var(--brand-deep-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; color: var(--foreground); }
h1 { font-size: 28px; font-weight: 700; line-height: 1.12; letter-spacing: -0.045em; }
h2 { font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -0.03em; }
h3 { font-size: 15px; font-weight: 700; }
@media (min-width: 640px) { h1 { font-size: 34px; } }
p { margin: 0 0 .5rem; }
.muted { color: var(--muted-foreground); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--brand-deep-text); margin-bottom: .35rem; }
.metric-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.code-id { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--slate-500); }
.financial-number { font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.035em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: .5rem; top: -3rem; z-index: 100; background: var(--card); padding: .5rem 1rem; border-radius: var(--radius-md); }
.skip-link:focus { top: .5rem; }
:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); border-radius: 6px; }

/* Shell */
.app-header { position: fixed; inset-inline: 0; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem; background: color-mix(in oklab, var(--card) 92%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 80%, transparent); }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--foreground); font-weight: 700; letter-spacing: -0.04em; font-size: 19px; }
.brand-mark { width: 2.1rem; height: 2.1rem; border-radius: var(--radius-lg); background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 1.2rem; height: 1.2rem; }
.header-spacer { flex: 1; }
.header-search { flex: 0 1 22rem; position: relative; }
.header-search input { height: 2.5rem; padding-left: 2.25rem; }
.header-search svg { position: absolute; left: .7rem; top: .7rem; width: 1.1rem; height: 1.1rem; color: var(--slate-400); }
.search-results { position: absolute; top: 2.9rem; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: 0 20px 40px -24px #1e293b; max-height: 60vh; overflow: auto; padding: .4rem; }
.search-results a { display: block; padding: .5rem .6rem; border-radius: var(--radius-md); text-decoration: none; color: var(--foreground); }
.search-results a:hover, .search-results a:focus { background: var(--accent); }
.icon-btn { position: relative; width: 2.5rem; height: 2.5rem; display: inline-grid; place-items: center; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; }
.icon-btn svg { width: 1.2rem; height: 1.2rem; }
.icon-btn .dot { position: absolute; top: -.3rem; right: -.3rem; min-width: 1.15rem; height: 1.15rem; border-radius: 999px; background: var(--destructive); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 .25rem; }
.user-chip { display: flex; align-items: center; gap: .5rem; }
.avatar { width: 2.2rem; height: 2.2rem; border-radius: 999px; background: var(--secondary); color: var(--brand-deep-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.menu-toggle { display: none; }
.layout { display: flex; padding-top: var(--header-h); min-height: 100vh; }
.sidebar { position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--side-w); overflow-y: auto; padding: 1rem .75rem 2rem; background: var(--card); border-right: 1px solid var(--border); z-index: 40; }
.sidebar .group { margin: 1rem 0 .3rem .6rem; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--slate-500); }
.sidebar a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: var(--radius-lg); color: var(--foreground); text-decoration: none; font-size: 14px; font-weight: 600; }
.sidebar a svg { width: 1.1rem; height: 1.1rem; color: var(--slate-500); flex: none; }
.sidebar a:hover { background: var(--muted); }
.sidebar a[aria-current="page"] { background: var(--accent); color: var(--brand-deep-text); }
.sidebar a[aria-current="page"] svg { color: var(--brand-deep-text); }
.sidebar .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--secondary); border-radius: 999px; padding: .05rem .5rem; }
main { flex: 1; min-width: 0; margin-left: var(--side-w); padding: 1.75rem 2rem 4rem; max-width: calc(1440px + var(--side-w)); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head .desc { margin-top: .35rem; color: var(--muted-foreground); max-width: 60rem; }
.backdrop { display: none; }
@media (max-width: 1023px) {
  .menu-toggle { display: inline-grid; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 20px 50px -20px #1e293b; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgb(15 23 42 / .35); z-index: 39; }
  main { margin-left: 0; padding: 1.25rem 1rem 4rem; }
  .header-search { display: none; }
  .header-search.open { display: block; position: fixed; top: var(--header-h); left: 0; right: 0; padding: .5rem 1rem; background: var(--card); border-bottom: 1px solid var(--border); flex: none; }
  .user-chip .who { display: none; }
}
@media (min-width: 1024px) { .search-toggle { display: none; } }
@media (min-width: 640px) and (max-width: 1023px) { main { padding: 1.5rem 1.5rem 4rem; } }

/* Cards */
.conserv-card { border: 1px solid var(--border); background: var(--card); color: var(--card-foreground); border-radius: var(--radius-2xl);
  box-shadow: 0 10px 30px -22px color-mix(in oklab, var(--navy) 34%, transparent), 0 1px 2px color-mix(in oklab, var(--navy) 8%, transparent); }
.card-pad { padding: 1.25rem; }
@media (min-width: 640px) { .card-pad { padding: 1.5rem; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.metrics { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.metric-card { position: relative; border-radius: var(--radius-2xl); padding: 1.25rem; overflow: hidden; text-decoration: none; color: inherit; display: block; }
.metric-card::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: var(--brand); }
.metric-card.mint::after { background: var(--mint); } .metric-card.amber::after { background: var(--amber-400); } .metric-card.navy::after { background: var(--navy); } .metric-card.red::after { background: var(--destructive); }
.metric-card .icon { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-xl); display: grid; place-items: center; margin-bottom: .9rem; background: color-mix(in oklab, var(--brand) 12%, transparent); color: var(--brand-deep-text); }
.metric-card.mint .icon { background: var(--emerald-50); color: var(--emerald-600); } .metric-card.amber .icon { background: var(--amber-50); color: var(--amber-600); }
.metric-card.navy .icon { background: var(--slate-50); color: var(--foreground); } .metric-card.red .icon { background: var(--red-50); color: var(--red-700); }
.metric-card .icon svg { width: 1.25rem; height: 1.25rem; }
.metric-value { font-size: 29px; font-weight: 700; line-height: 1; margin-top: .4rem; }
@media (min-width: 640px) { .metric-value { font-size: 32px; } }
a.metric-card:hover { transform: translateY(-2px); transition: transform .18s cubic-bezier(.2,.8,.3,1); }
.record-card { border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); padding: .875rem 1rem; box-shadow: 0 8px 22px -20px #1e293b; transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .18s; }
a.record-card { display: block; text-decoration: none; color: inherit; }
a.record-card:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -22px #1e293b; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px; border: 1px solid; padding: .22rem .65rem; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.3; }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.slate { border-color: var(--slate-200); background: var(--slate-50); color: var(--slate-700); }
.badge.blue { border-color: var(--blue-200); background: var(--blue-50); color: var(--blue-700); }
.badge.amber { border-color: var(--amber-200); background: var(--amber-50); color: var(--amber-700); }
.badge.emerald { border-color: var(--emerald-200); background: var(--emerald-50); color: var(--emerald-700); }
.badge.violet { border-color: var(--violet-200); background: var(--violet-50); color: var(--violet-700); }
.badge.destructive { border-color: color-mix(in oklab, var(--destructive) 32%, var(--card)); background: color-mix(in oklab, var(--destructive) 10%, var(--card)); color: var(--destructive-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 2.5rem; padding: 0 1rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--card); color: var(--foreground); font: 600 14px var(--ff-sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--muted); }
.btn svg { width: 1rem; height: 1rem; }
.btn.primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; box-shadow: 0 12px 25px -12px rgba(59,130,246,.9); font-weight: 700; }
.btn.primary:hover { background: var(--brand-deep); }
.btn.lg { height: 3rem; padding: 0 1.5rem; border-radius: var(--radius-xl); font-size: 16px; }
.btn.danger { color: var(--destructive-text); border-color: color-mix(in oklab, var(--destructive) 35%, var(--card)); }
.btn.danger:hover { background: color-mix(in oklab, var(--destructive) 8%, var(--card)); }
.btn.success { background: var(--emerald-600); color: #fff; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 2rem; padding: 0 .7rem; font-size: 13px; border-radius: var(--radius-md); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
@media (max-width: 639px) { .btn-row.stretch > .btn { flex: 1 1 auto; } }

/* Forms */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--foreground); }
.field .hint { font-size: 12px; color: var(--muted-foreground); }
.req::after { content: " *"; color: var(--destructive-text); }
input, select, textarea { width: 100%; font: 400 15px var(--ff-sans); color: var(--foreground); background: var(--card); border: 1px solid var(--input); border-radius: var(--radius-xl); padding: 0 .9rem; height: 2.75rem; box-shadow: 0 1px 2px rgb(15 23 42 / .04); }
textarea { padding: .65rem .9rem; height: auto; min-height: 5.5rem; resize: vertical; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; box-shadow: none; accent-color: var(--brand); padding: 0; }
input[type="file"] { padding: .55rem .7rem; height: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ring); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--destructive); }
.field-error { color: var(--destructive-text); font-size: 13px; font-weight: 600; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: 14px; }
.check input { margin-top: .2rem; flex: none; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 1rem; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 .4rem; font-size: 14px; }
.segmented { display: inline-grid; grid-auto-flow: column; gap: .25rem; background: var(--muted); padding: .25rem; border-radius: var(--radius-xl); }
.segmented button, .segmented a { border: 0; background: transparent; padding: .45rem .9rem; border-radius: var(--radius-lg); font: 600 14px var(--ff-sans); color: var(--muted-foreground); cursor: pointer; text-decoration: none; white-space: nowrap; }
.segmented [aria-selected="true"], .segmented [aria-current="page"] { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgb(15 23 42 / .12); }
.tabs-scroll { overflow-x: auto; max-width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); background: color-mix(in oklab, var(--muted) 60%, var(--card)); white-space: nowrap; }
th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: .3rem; align-items: center; }
th button.sort:focus-visible { box-shadow: 0 0 0 2px var(--ring); border-radius: 4px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: color-mix(in oklab, var(--accent) 55%, var(--card)); }
td.num, th.num { text-align: right; }
/* Tabelas viram cartões em telas pequenas */
@media (max-width: 719px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--border); padding: .6rem .2rem; }
  table.responsive td { border: 0; padding: .2rem .75rem; display: flex; gap: .75rem; justify-content: space-between; text-align: right; }
  table.responsive td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-align: left; flex: none; max-width: 45%; }
  table.responsive td.num { text-align: right; }
}
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.toolbar .field { flex: 1 1 11rem; }
.toolbar .field.grow { flex: 3 1 16rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .9rem; flex-wrap: wrap; }

/* States */
.empty { border: 1px dashed var(--border); border-radius: var(--radius-xl); padding: 2rem 1rem; text-align: center; color: var(--muted-foreground); }
.empty svg { width: 2rem; height: 2rem; color: var(--slate-400); margin-bottom: .4rem; }
.loading { display: flex; align-items: center; gap: .6rem; color: var(--muted-foreground); padding: 2rem 0; justify-content: center; }
.spinner { width: 1.15rem; height: 1.15rem; border-radius: 999px; border: 2px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } * { transition: none !important; } }
.skeleton { background: linear-gradient(90deg, var(--muted), color-mix(in oklab, var(--muted) 50%, var(--card)), var(--muted)); background-size: 200% 100%; border-radius: var(--radius-md); height: 1rem; animation: sk 1.4s ease infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.alert { border-radius: var(--radius-xl); border: 1px solid; padding: .8rem 1rem; font-size: 14px; display: flex; gap: .6rem; align-items: flex-start; }
.alert svg { width: 1.1rem; height: 1.1rem; flex: none; margin-top: .15rem; }
.alert.info { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.alert.warn { background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-700); }
.alert.error { background: color-mix(in oklab, var(--destructive) 8%, var(--card)); border-color: color-mix(in oklab, var(--destructive) 30%, var(--card)); color: var(--destructive-text); }
.alert.ok { background: var(--emerald-50); border-color: var(--emerald-200); color: var(--emerald-700); }
.alert a { color: inherit; font-weight: 700; }

/* Toasts & modal */
.toasts { position: fixed; z-index: 200; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: min(26rem, calc(100vw - 2rem)); }
.toast { background: var(--navy); color: #fff; padding: .8rem 1rem; border-radius: var(--radius-xl); box-shadow: 0 20px 40px -20px #0f172a; font-size: 14px; }
:root:not([data-theme="light"]) .toast { color: oklch(20% .03 255); }
@media (prefers-color-scheme: light) { .toast { color: #fff; } }
.toast.error { background: var(--destructive); color: #fff; }
.toast.ok { background: var(--emerald-600); color: #fff; }
dialog { border: 1px solid var(--border); border-radius: var(--radius-2xl); padding: 0; width: min(44rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); background: var(--card); color: var(--foreground); box-shadow: 0 30px 60px -30px #0f172a; }
dialog::backdrop { background: rgb(15 23 42 / .45); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 1; }
dialog .dlg-body { padding: 1.25rem; }
dialog .dlg-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--card); }
dialog.wide { width: min(64rem, calc(100vw - 1.5rem)); }

/* Detail */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .9rem 1.25rem; margin: 0; }
.kv dt { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.kv dd { margin: .15rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ""; position: absolute; left: .35rem; top: .45rem; width: .55rem; height: .55rem; border-radius: 999px; background: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 18%, transparent); }
.timeline li::after { content: ""; position: absolute; left: .6rem; top: 1.1rem; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.restrito::before { background: var(--violet-700); }
.split { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1180px) { .split { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); } }
.stepper { display: flex; gap: .4rem; flex-wrap: wrap; }
.stepper span { font-size: 12px; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); }
.stepper span.done { background: var(--emerald-50); color: var(--emerald-700); }
.stepper span.now { background: var(--brand); color: #fff; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: .75rem; max-height: 32rem; overflow-y: auto; padding: .25rem; }
.msg { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: .7rem .85rem; background: var(--card); }
.msg.mine { background: color-mix(in oklab, var(--accent) 60%, var(--card)); }
.msg.restrito { border-color: var(--violet-200); }
.msg .meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: 12px; color: var(--muted-foreground); margin-bottom: .25rem; }
.msg .meta strong { color: var(--foreground); font-size: 13px; }
.msg .actions { display: flex; gap: .25rem; margin-top: .35rem; }
.vis-note { font-size: 12px; font-weight: 600; padding: .45rem .7rem; border-radius: var(--radius-md); background: var(--muted); color: var(--muted-foreground); }
.vis-note.restrito { background: var(--violet-50); color: var(--violet-700); }

/* Comparativo */
.score-bar { height: .45rem; background: var(--muted); border-radius: 999px; overflow: hidden; min-width: 4rem; }
.score-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.rank { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 999px; background: var(--secondary); font-weight: 700; font-size: 13px; }
.rank.first { background: var(--brand); color: #fff; }
.source { font-size: 12px; color: var(--muted-foreground); }
.ni { color: var(--amber-700); font-weight: 600; }
.hl-row td { background: color-mix(in oklab, var(--emerald-50) 70%, var(--card)); }
.inelegivel td { background: color-mix(in oklab, var(--destructive) 5%, var(--card)); }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 960px) { .auth { grid-template-columns: 1.05fr 1fr; } }
.auth-hero { display: none; background: var(--navy); color: #fff; padding: 3rem; position: relative; overflow: hidden; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-hero { background: oklch(21% .045 255); } }
@media (min-width: 960px) { .auth-hero { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-hero .soft-grid { position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(to right, rgb(255 255 255 / .25) 1px, transparent 1px), linear-gradient(to bottom, rgb(255 255 255 / .25) 1px, transparent 1px); background-size: 32px 32px; -webkit-mask-image: linear-gradient(160deg, #000 10%, transparent 70%); mask-image: linear-gradient(160deg, #000 10%, transparent 70%); }
.auth-hero h1 { color: #fff; font-size: 54px; line-height: 1.04; letter-spacing: -0.045em; max-width: 12ch; position: relative; }
.auth-hero p { color: rgb(255 255 255 / .78); font-size: 18px; line-height: 28px; max-width: 34rem; position: relative; }
.auth-hero .brand { color: #fff; position: relative; }
.auth-hero ul { position: relative; list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .7rem; color: rgb(255 255 255 / .85); }
.auth-hero li { display: flex; gap: .6rem; align-items: center; }
.auth-hero li svg { width: 1.1rem; height: 1.1rem; color: var(--mint); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 27rem; padding: 2rem 1.5rem; }
@media (min-width: 640px) { .auth-card { padding: 2.25rem 2.25rem; } }
.auth-card input { height: 3rem; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; font-size: 14px; }
.demo-box { margin-top: 1.25rem; font-size: 13px; }
.demo-box summary { cursor: pointer; font-weight: 600; }
.demo-box table { font-size: 13px; }
.demo-box td, .demo-box th { padding: .35rem .5rem; }

.divider { height: 1px; background: var(--border); margin: 1.25rem 0; border: 0; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: 12px; font-weight: 600; padding: .15rem .55rem; border-radius: var(--radius-md); background: var(--muted); color: var(--muted-foreground); }
.items-editor .item-row { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 1rem; position: relative; }
.items-editor .item-row + .item-row { margin-top: .75rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-0 { margin-top: 0 !important; }
.hidden { display: none !important; }
.notif-panel { position: fixed; top: calc(var(--header-h) + .4rem); right: .75rem; width: min(24rem, calc(100vw - 1.5rem)); max-height: 70vh; overflow-y: auto; z-index: 60; padding: .75rem; }
.notif-panel a { display: block; padding: .6rem .7rem; border-radius: var(--radius-lg); text-decoration: none; color: var(--foreground); }
.notif-panel a:hover { background: var(--muted); }
.notif-panel a.unread { background: color-mix(in oklab, var(--accent) 70%, var(--card)); }
.bars { display: grid; gap: .5rem; }
.bars .bar-row { display: grid; grid-template-columns: minmax(7rem, 14rem) 1fr 3rem; gap: .75rem; align-items: center; font-size: 13px; }
.bars .bar { height: .7rem; border-radius: 999px; background: var(--muted); overflow: hidden; }
.bars .bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
@media print { .app-header, .sidebar, .btn, .toolbar { display: none !important; } main { margin: 0; padding: 0; } }

/* Ajustes finos */
.auth-hero h1 { margin-bottom: 1.25rem; }
td.col-title { min-width: 13rem; }
ol.rank-list > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; align-items: center; }
@media (max-width: 479px) {
  .brand-text { display: none; }
  .app-header { gap: .45rem; padding: 0 .75rem; }
  .icon-btn { width: 2.35rem; height: 2.35rem; }
}

.segmented { max-width: 100%; overflow-x: auto; }

/* Campo de arquivo padronizado */
.filepick { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; min-height: 2.75rem; padding: .35rem .5rem; border: 1px dashed var(--input); border-radius: var(--radius-xl); background: var(--card); }
.filepick:focus-within { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.filepick label.btn { cursor: pointer; }
.filepick-names { overflow-wrap: anywhere; }
/* Integrações na barra lateral */
.side-integrations { padding: 0 .7rem; display: grid; gap: .35rem; font-size: 12px; color: var(--muted-foreground); }
.side-integrations div { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
td.col-desc { min-width: 14rem; }
.hint-inline { font-size: 13px; color: var(--muted-foreground); }
@media (max-width: 639px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .metric-card { padding: .9rem; border-radius: var(--radius-xl); }
  .metric-card .icon { width: 2rem; height: 2rem; margin-bottom: .5rem; border-radius: var(--radius-lg); }
  .metric-card .metric-label { font-size: 10.5px; letter-spacing: .06em; }
  .metric-value { font-size: 22px; }
}
@media (max-width: 719px) {
  table.responsive td { display: block; text-align: right; overflow-wrap: anywhere; }
  table.responsive td::before { float: left; margin-right: .75rem; text-align: left; max-width: 45%; }
  table.responsive td::after { content: ""; display: block; clear: both; }
  table.responsive td .btn-row { justify-content: flex-end; }
}

.filter-toggle { display: none; }
@media (max-width: 639px) {
  .filter-toggle { display: inline-flex; align-self: flex-end; height: 2.75rem; }
  form.toolbar:not(.open) > .field:not(.grow) { display: none; }
  form.toolbar > .field.grow { flex: 1 1 60%; }
}

.doc-feedback { font-size: 13px; font-weight: 600; min-height: 1em; }
.doc-feedback.ok { color: var(--emerald-700); }
.doc-feedback.bad { color: var(--destructive-text); }
input.doc-ok { border-color: var(--emerald-600); }
input.doc-bad { border-color: var(--destructive); }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.decl-text { max-height: 18rem; overflow-y: auto; white-space: pre-wrap; background: var(--muted); border-radius: var(--radius-lg); padding: 1rem; font-size: 14px; line-height: 1.6; }
.public-shell { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; background: var(--card); border-bottom: 1px solid var(--border); }
@media (min-width: 720px) { .row-actions { flex-wrap: nowrap; white-space: nowrap; } }
