/* ==========================================================================
   ZenPrismos — Design system do webapp.
   Fonte única de cor, tipo e forma. --brand é sobrescrita em runtime a partir
   de system_settings.brand_primary_color (ver static/js/app.js).
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-latin-wght.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --brand: #0f766e;
  --on-brand: #ffffff;
  --brand-ink: color-mix(in srgb, var(--brand) 88%, #000);
  --brand-deep: color-mix(in srgb, var(--brand) 62%, #04121a);
  --brand-tonal: color-mix(in srgb, var(--brand) 9%, var(--surface));
  --brand-tonal-hover: color-mix(in srgb, var(--brand) 16%, var(--surface));

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --hover: #f2f4f7;
  --border: #e5e7eb;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;

  --good: #067647;  --good-bg: #ecfdf3;
  --warn: #b54708;  --warn-bg: #fffaeb;
  --bad: #b42318;   --bad-bg: #fef3f2;
  --neutral-bg: #f2f4f7;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 16px -4px rgba(16, 24, 40, .1);
  --shadow-lg: 0 20px 24px -4px rgba(16, 24, 40, .1), 0 8px 8px -4px rgba(16, 24, 40, .04);

  --topbar-h: 72px;
  --footer-h: 32px;
  --sidebar-w: 288px;
  --content-w: 1152px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --brand-ink: color-mix(in srgb, var(--brand) 50%, #fff);
  --brand-tonal: color-mix(in srgb, var(--brand) 22%, var(--surface));
  --brand-tonal-hover: color-mix(in srgb, var(--brand) 32%, var(--surface));
  --bg: #0c111d;
  --surface: #121824;
  --surface-muted: #161d2b;
  --hover: #1f2838;
  --border: #252e3f;
  --border-strong: #344054;
  --text: #f2f4f7;
  --text-2: #b4bcc9;
  --text-3: #94a0b1;
  --good: #47cd89;  --good-bg: #0a2b1e;
  --warn: #fdb022;  --warn-bg: #33230a;
  --bad: #f97066;   --bad-bg: #3a1513;
  --neutral-bg: #1f2838;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, .5);
  --shadow-lg: 0 20px 24px -4px rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss03';
}
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
#main:focus { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 8px 16px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: 8px; }
.noscript { padding: 32px; text-align: center; }

/* ---- Shell ------------------------------------------------------------- */
.shell { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.shell__body { position: relative; display: flex; flex: 1; min-height: 0; }

.topbar {
  z-index: 20; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--topbar-h); padding: 0 24px 0 12px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar__start, .topbar__end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__end { flex-shrink: 0; }
.topbar__link {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-weight: 600; color: var(--text-2); transition: background .15s;
}
.topbar__link:hover { background: var(--hover); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.brand__wrap { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1; }
/* wide.svg declara 16:9 mas o desenho é 3,5:1: a caixa precisa ser explícita. */
.brand__logo-img { width: 170px; height: 48px; transition: filter .2s; }
:root[data-theme='dark'] .brand__logo-img { filter: brightness(0) invert(1); }
.brand__tagline { font-size: 9.5px; color: var(--text-3); font-weight: 500; margin-top: 3px; letter-spacing: -0.01em; white-space: nowrap; line-height: 1.1; }
.brand__mark { display: none; }
.brand__text { display: none; }

.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--text-2); transition: background .15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 13px; font-weight: 700;
  background: var(--brand-tonal); color: var(--brand-ink); box-shadow: 0 0 0 1px var(--border), 0 0 0 3px var(--surface), 0 0 0 4px var(--border);
}
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---- Busca ------------------------------------------------------------- */
.search {
  position: relative; display: flex; align-items: center; gap: 8px; width: 400px; max-width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.search:hover { border-color: var(--border-strong); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tonal); }
.search__icon { color: var(--text-3); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
.search input::placeholder { color: var(--text-3); }
.search kbd { padding: 0 6px; border: 1px solid var(--border); border-radius: 5px; font: 500 11px/18px var(--font); color: var(--text-3); }
.search__results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30; max-height: 360px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.search__results li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); }
.search__results li small { margin-left: auto; color: var(--text-3); font-size: 12px; }
.search__results li[aria-selected='true'], .search__results li:hover { background: var(--hover); color: var(--text); }
.search__empty { cursor: default !important; }

/* ---- Sidebar ----------------------------------------------------------- */
.sidebar {
  z-index: 15; width: var(--sidebar-w); flex-shrink: 0; display: grid; grid-auto-rows: max-content; gap: 16px; padding: 16px;
  overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); scrollbar-width: thin;
  transition: width .2s ease, padding .2s ease, margin-left .2s ease;
}
@media (min-width: 1024px) {
  .shell--collapsed .sidebar {
    width: 72px; min-width: 72px; padding: 16px 8px; margin-left: 0; visibility: visible;
  }
  .shell--collapsed .side-title,
  .shell--collapsed .side-section > h2,
  .shell--collapsed .group__head > span:nth-child(2),
  .shell--collapsed .group__chev,
  .shell--collapsed .nav__link > span:first-of-type,
  .shell--collapsed .nav__ext,
  .shell--collapsed .sidebar hr {
    display: none;
  }
  .shell--collapsed .group {
    border: none; padding: 2px 0; background: transparent; box-shadow: none; margin-top: 4px;
  }
  .shell--collapsed .group__head {
    grid-template-columns: 1fr; justify-items: center; padding: 4px 0;
  }
  .shell--collapsed .group__tile {
    width: 38px; height: 38px;
  }
  .shell--collapsed .group__list {
    padding-left: 0; display: grid !important; gap: 4px; margin-top: 4px;
  }
  .shell--collapsed .group__list::before,
  .shell--collapsed .group__list .nav__link::before {
    display: none;
  }
  .shell--collapsed .nav__link {
    justify-content: center; padding: 10px 0; border-radius: var(--radius-sm);
  }
  .shell--collapsed .nav__link svg {
    margin: 0;
  }
}
.sidebar hr { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--border); }
.nav { display: grid; gap: 2px; }
.nav__link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: var(--radius-sm); text-align: left;
  color: var(--text-2); font-weight: 600; transition: background .15s;
}
.nav__link:hover { background: var(--hover); }
.nav__link[aria-current='page'] { background: var(--brand-tonal); color: var(--brand-ink); font-weight: 700; }
.nav__link > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__ext { color: var(--text-3); }
.side-title { padding: 0 6px; font-size: 15px; font-weight: 700; }
.side-section { display: grid; gap: 12px; }

.group { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.group + .group { margin-top: -4px; }
.group__head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; text-align: left; font-weight: 600; font-size: 15px; }
.group__tile { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--brand-tonal); color: var(--brand-ink); }
.group__chev { color: var(--text-3); transition: transform .15s; }
.group__head[aria-expanded='true'] .group__chev { transform: rotate(180deg); }
.group__list { position: relative; display: grid; gap: 2px; padding-left: 12px; }
.group__list::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 1px; background: var(--border-strong); }
.group__list .nav__link { position: relative; }
.group__list .nav__link::before { content: ''; position: absolute; left: -12px; top: 50%; width: 12px; height: 1px; background: var(--border-strong); }

.scrim { position: absolute; inset: 0; z-index: 14; background: rgba(16, 24, 40, .45); }

/* ---- Main -------------------------------------------------------------- */
.main { flex: 1; min-width: 0; overflow: auto; display: flex; flex-direction: column; background: var(--bg); }
#view { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 0; }
.main--flush { overflow: hidden; }
.main--flush #view { flex: 1 1 0; }
.page { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 32px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-content: start; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--text-3); margin-top: 2px; }
.page-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.banner-wrap { padding: 24px 24px 0; }
.banner {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 160px; padding: 24px 32px; border-radius: var(--radius-md); color: #fff;
  background: linear-gradient(115deg, var(--brand-deep), color-mix(in srgb, var(--brand) 82%, #04121a) 58%, var(--brand));
}
.banner__art { position: absolute; right: -24px; top: -60px; width: 420px; height: 300px; opacity: .16; pointer-events: none; color: #fff; }
.banner__text { position: relative; }
.banner h1 { font-size: 26px; line-height: 34px; font-weight: 700; letter-spacing: -.02em; }
.banner p { margin-top: 4px; font-size: 15px; color: rgba(255, 255, 255, .84); }
.banner .btn { position: relative; flex-shrink: 0; background: #fff; color: #101828; border-color: transparent; }
.banner .btn:hover { background: #f2f4f7; }

.section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.section__head { display: flex; align-items: center; gap: 16px; }
.section__title { flex: 1; min-width: 0; }
.section__title h2 { font-size: 16px; line-height: 24px; font-weight: 700; }
.section__title p { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Botões e controles ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; flex-shrink: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 600; transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-xs); }
.btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); box-shadow: var(--shadow-xs); }
.btn--secondary:hover:not(:disabled) { background: var(--hover); }
.btn--tonal { background: var(--brand-tonal); color: var(--brand-ink); border-radius: var(--radius-md); }
.btn--tonal:hover:not(:disabled) { background: var(--brand-tonal-hover); }
.btn--danger { background: var(--bad); color: #fff; }
:root[data-theme='dark'] .btn--danger { color: #1a0605; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--neutral-bg); border-radius: 10px; }
.segmented button { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.input, .select {
  width: 100%; height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tonal); }
.input[readonly] { background: var(--surface-muted); color: var(--text-3); }
.select--auto, .input--auto { width: auto; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 500; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 13px; }
.color-field { display: flex; gap: 8px; }
.color-field input[type='color'] { width: 44px; height: 40px; padding: 3px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }

/* ---- Login -------------------------------------------------------------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--surface-muted); }
.login__card { width: 100%; max-width: 400px; padding: 32px; display: grid; gap: 20px; }
.login__head { display: grid; justify-items: center; gap: 8px; text-align: center; }
.login__head img { margin-bottom: 4px; border-radius: var(--radius-md); }
.login__head h1 { font-size: 22px; line-height: 30px; font-weight: 700; letter-spacing: -.02em; }
.login__head p { color: var(--text-2); overflow-wrap: anywhere; }
.login__form { display: grid; gap: 16px; }
.login__form[hidden] { display: none; }
.login__channels { display: flex; }
.login__channels button { flex: 1; }
.login__code { font-size: 20px; letter-spacing: .24em; text-align: center; font-variant-numeric: tabular-nums; }
.login__error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad); font-weight: 500; }
.login__links { display: flex; justify-content: space-between; gap: 16px; }
.login__link { color: var(--brand-ink); font-weight: 600; font-size: 13px; }
.login__link:disabled { color: var(--text-3); cursor: default; font-weight: 500; }

/* ---- Cartões ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.rail { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.rail > * { scroll-snap-align: start; flex-shrink: 0; }

.kpi { width: 216px; padding: 16px; display: grid; gap: 8px; align-content: start; }
.kpi__head { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-weight: 500; }
.kpi__tile { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand-tonal); color: var(--brand-ink); }
.kpi__value { font-size: 22px; line-height: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__hint { color: var(--text-3); font-size: 12px; line-height: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.kpi-grid .kpi { width: auto; }

.module { width: 248px; overflow: hidden; display: grid; grid-auto-rows: max-content; }
.module__cover { height: 96px; background: linear-gradient(135deg, var(--brand-deep), var(--brand)); position: relative; overflow: hidden; }
.module__cover svg { position: absolute; right: -24px; bottom: -36px; width: 140px; height: 140px; color: #fff; opacity: .13; }
.module__tile { display: grid; place-items: center; width: 48px; height: 48px; margin: -24px 0 0 16px; position: relative; border: 4px solid var(--surface); border-radius: var(--radius-md); background: var(--brand-tonal); color: var(--brand-ink); box-sizing: content-box; }
.module__body { display: grid; gap: 8px; padding: 12px 16px 16px; }
.module__body h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
.module__body p { font-size: 12px; line-height: 18px; color: var(--text-3); height: 54px; overflow: hidden; }

.badge { display: inline-flex; align-items: center; width: fit-content; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.badge--neutral { background: var(--neutral-bg); color: var(--text-2); }
.badge--good { background: var(--good-bg); color: var(--good); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money--in { color: var(--good); }
.money--out { color: var(--bad); }

/* ---- Timeline ----------------------------------------------------------- */
.timeline { display: grid; gap: 0; }
.tl-row { position: relative; display: grid; grid-template-columns: 112px 72px minmax(0, 1fr); }
.tl-date { padding: 16px 0; text-align: right; }
.tl-date strong { display: block; font-size: 14px; line-height: 20px; font-weight: 600; }
.tl-date span { font-size: 12px; line-height: 18px; color: var(--text-3); }
.tl-date--late strong { color: var(--bad); }
.tl-mark { display: flex; align-items: center; height: 36px; margin-top: 16px; padding-left: 20px; }
.tl-mark i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.tl-mark b { flex: 1; height: 1px; background: var(--border); }
.tl-row::after { content: ''; position: absolute; left: 135.5px; top: 42px; bottom: -16px; width: 1px; background: var(--border); }
.tl-row:last-child::after { display: none; }
.tl-items { display: grid; gap: 8px; padding: 12px 0; }
.tl-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); transition: box-shadow .15s;
}
.tl-card:hover { box-shadow: var(--shadow-md); }
.tl-card h3 { font-size: 14px; font-weight: 600; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-card p { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.tl-card .money { font-weight: 600; }
.center { display: flex; justify-content: center; }

/* ---- Listas e tabelas --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { position: sticky; top: 0; padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child { border-top-right-radius: var(--radius-lg); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-muted); }
.table .num { text-align: right; }
.table .strong { font-weight: 600; }
.table .muted { color: var(--text-3); font-size: 13px; }

.statement { display: grid; }
.statement > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.statement > div:last-child { border-bottom: 0; }
.statement .total { font-weight: 700; color: var(--text); background: var(--surface-muted); }
.statement > div:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.statement > div:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.approval { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 16px; }
.approval h3 { font-size: 14px; font-weight: 600; }
.approval p { font-size: 13px; color: var(--text-3); }
.approval__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.approval__actions { display: flex; gap: 8px; }
.stack { display: grid; gap: 8px; }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; scrollbar-width: thin; }
.board__col { width: 264px; flex-shrink: 0; display: grid; gap: 8px; padding: 10px; border-radius: var(--radius-md); background: var(--surface-muted); border: 1px solid var(--border); }
.board__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px; font-weight: 600; }
.board__head span:last-child { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.board__card { display: grid; gap: 6px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); }
.board__card h3 { font-size: 13px; line-height: 18px; font-weight: 600; }
.board__card p { font-size: 12px; color: var(--text-3); }
.board__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.board__empty { padding: 12px 4px; text-align: center; font-size: 12px; color: var(--text-3); }

.state { display: grid; justify-items: center; gap: 6px; padding: 40px 24px; text-align: center; color: var(--text-3); }
.state__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 50%; background: var(--neutral-bg); color: var(--text-2); }
.state h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.state .btn { margin-top: 10px; }
.skeleton { height: 96px; border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--neutral-bg), var(--surface-muted), var(--neutral-bg)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Copiloto ----------------------------------------------------------- */
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.chat__side { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 16px; border-right: 1px solid var(--border); background: var(--surface-muted); }
.chat__sessions { flex: 1; overflow-y: auto; display: grid; grid-auto-rows: max-content; gap: 2px; scrollbar-width: thin; }
.chat__sessions h2 { padding: 4px 8px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.chat__session { display: grid; width: 100%; padding: 8px; border-radius: var(--radius-sm); text-align: left; }
.chat__session:hover { background: var(--hover); }
.chat__session[aria-current='true'] { background: var(--brand-tonal); color: var(--brand-ink); }
.chat__session span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chat__session small { font-size: 12px; color: var(--text-3); }
.chat__main { display: flex; flex-direction: column; min-height: 0; }
.chat__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--border); }
.chat__bar > div { display: flex; align-items: center; gap: 10px; }
.chat__bar .muted { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.chat__feed { flex: 1; min-height: 0; overflow-y: auto; }
.chat__feed-inner { max-width: 780px; margin: 0 auto; padding: 24px; display: grid; gap: 20px; }
.msg { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.msg--user { justify-content: flex-end; }
.msg__avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand-tonal); color: var(--brand-ink); flex-shrink: 0; }
.msg__bubble { min-width: 0; max-width: 100%; display: grid; gap: 4px; line-height: 22px; overflow-wrap: anywhere; }
.msg--user .msg__bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--brand); color: var(--on-brand); }
.msg--bot .msg__bubble { flex: 1; padding-top: 4px; }
.msg__bubble ul { list-style: disc; padding-left: 20px; }
.msg__error { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); transition: background .15s; }
.chip:hover { background: var(--hover); }
.approval-card { display: grid; gap: 8px; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--radius-sm); background: var(--surface); }
.approval-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.approval-card p { font-size: 13px; color: var(--text-2); }
.dots { display: inline-flex; gap: 4px; padding: 8px 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { padding: 12px 24px 16px; }
.composer form { display: flex; align-items: center; gap: 8px; max-width: 732px; margin: 0 auto; padding: 6px 6px 6px 16px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-xs); }
.composer form:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tonal); }
.composer input { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; }

/* ---- Ajustes ------------------------------------------------------------ */
.settings { display: grid; gap: 16px; max-width: 768px; }
.settings .card { padding: 20px; display: grid; gap: 16px; }
.settings h2 { font-size: 15px; font-weight: 700; }
.settings h2 + p { margin-top: -12px; color: var(--text-3); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings__actions { display: flex; justify-content: flex-end; }

/* ---- Rodapé, FAB, toasts, diálogo --------------------------------------- */
.footer { flex-shrink: 0; display: flex; align-items: center; gap: 24px; height: var(--footer-h); padding: 0 24px; background: var(--surface); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); white-space: nowrap; }
.footer nav { margin-left: auto; }
.footer__links { display: flex; gap: 20px; }
.footer__links a:hover { color: var(--text); text-decoration: underline; }
.footer__status { display: flex; align-items: center; gap: 6px; }
.footer__status i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.footer__status[data-down] i { background: var(--bad); }

.fab { position: absolute; right: 24px; bottom: calc(var(--footer-h) + 16px); z-index: 12; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-lg); transition: transform .15s; }
.fab:hover { transform: scale(1.05); }

.toasts { position: fixed; right: 24px; bottom: calc(var(--footer-h) + 84px); z-index: 60; display: grid; gap: 8px; max-width: 380px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-weight: 500; }
.toast--good svg { color: var(--good); }
.toast--bad svg { color: var(--bad); }

.dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog--lg { width: min(580px, calc(100vw - 32px)); max-height: 88vh; overflow-y: auto; }
.dialog::backdrop { background: rgba(16, 24, 40, .5); }
.dialog h2 { font-size: 18px; font-weight: 700; margin: 0; }
.dialog p { margin-top: 8px; color: var(--text-2); }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.dialog__head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.dialog__head p { margin-top: 4px; color: var(--text-3); font-size: 13px; }
.dialog__body { display: grid; gap: 14px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.table-actions { display: inline-flex; align-items: center; gap: 6px; }

/* Tabela que cabe na largura: colunas fixas, texto quebra em vez de gerar rolagem. */
.table--fit { table-layout: fixed; }
.table--fit td { overflow-wrap: anywhere; }
.table--fit td.nowrap { white-space: nowrap; }
.table--fit th, .table--fit td { padding-left: 12px; padding-right: 12px; }
.cell-stack { display: grid; gap: 2px; line-height: 1.3; }
.cell-stack small { color: var(--text-3); font-size: 12px; font-weight: 400; }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--danger { color: var(--bad); }
.note { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-muted); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.note svg { flex-shrink: 0; margin-top: 2px; color: var(--brand-ink); }
.conn-group { display: grid; gap: 12px; }
.conn-group + .conn-group { margin-top: 24px; }
.conn-group > h3 { font-size: 13px; font-weight: 700; color: var(--text-3); }
.conn-card__test { margin: -6px 0 12px; font-size: 12px; color: var(--text-3); }
.conn-card__test[data-ok="false"] { color: var(--bad); }
.conn-card__actions { display: flex; gap: 6px; }
.copy-field { display: flex; gap: 8px; align-items: stretch; }
.copy-field code { flex: 1; min-width: 0; padding: 8px; border-radius: var(--radius-sm); background: var(--surface-muted); font-size: 12px; overflow-wrap: anywhere; }
.board__card-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; }
.card-proposal-url { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-muted); border: 1px dashed var(--brand); word-break: break-all; }

/* ---- Breadcrumb --------------------------------------------------------- */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; padding: 16px 24px 0; max-width: var(--content-w);
  margin: 0 auto; width: 100%; font-size: 13px; color: var(--text-3);
}
.breadcrumb ol { display: flex; align-items: center; gap: 8px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.breadcrumb li { display: flex; align-items: center; gap: 8px; }
.breadcrumb a { color: var(--text-2); transition: color .15s; font-weight: 500; }
.breadcrumb a:hover { color: var(--brand-ink); text-decoration: underline; }
.breadcrumb__sep { color: var(--border-strong); user-select: none; }
.breadcrumb__curr { color: var(--text); font-weight: 600; }

/* ---- Board Drag and Drop ------------------------------------------------ */
.board__card[draggable="true"] { cursor: grab; user-select: none; }
.board__card[draggable="true"]:active { cursor: grabbing; }
.board__card--dragging { opacity: 0.35; transform: scale(0.97); }
.board__col--dragover {
  background: var(--brand-tonal) !important;
  outline: 2px dashed var(--brand);
  outline-offset: -3px;
  border-radius: var(--radius-md);
}

/* ---- Tabs & Conexões ---------------------------------------------------- */
.tabs { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; color: var(--text-2); background: transparent; transition: all .15s; white-space: nowrap; }
.tab-btn:hover { background: var(--hover); color: var(--text); }
.tab-btn[aria-selected="true"] { background: var(--brand-tonal); color: var(--brand-ink); font-weight: 700; }

.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.conn-card { display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.conn-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.conn-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.conn-card__meta { display: flex; align-items: center; gap: 12px; }
.conn-card__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--brand-tonal); color: var(--brand-ink); flex-shrink: 0; }
.conn-card__info strong { display: block; font-size: 15px; font-weight: 700; color: var(--text); }
.conn-card__info small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.conn-card__desc { margin: 12px 0 16px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.conn-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---- Responsivo --------------------------------------------------------- */
@media (max-width: 1023px) {
  .sidebar { position: absolute; top: 0; bottom: 0; left: 0; margin-left: calc(var(--sidebar-w) * -1); visibility: hidden; box-shadow: var(--shadow-lg); }
  .shell--collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
  .shell--drawer .sidebar { margin-left: 0; visibility: visible; }
  .search { width: auto; flex: 1; max-width: 320px; }
  .topbar__label { display: none; }
}
@media (max-width: 767px) {
  .topbar { padding: 0 12px 0 8px; gap: 8px; }
  .search { display: none; }
  .brand__text small { display: none; }
  .page { padding: 20px 16px 40px; gap: 24px; }
  .banner-wrap { padding: 16px 16px 0; }
  .banner { padding: 20px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .banner h1 { font-size: 22px; line-height: 28px; }
  .tl-row { grid-template-columns: minmax(0, 1fr); }
  .tl-row::after, .tl-mark { display: none; }
  .tl-date { display: flex; align-items: baseline; gap: 8px; padding: 12px 0 0; text-align: left; }
  .tl-items { padding: 6px 0; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat__side { display: none; }
  .chat__bar, .composer { padding-left: 16px; padding-right: 16px; }
  .chat__feed-inner { padding: 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .approval { grid-template-columns: minmax(0, 1fr); }
  .fab { right: 16px; bottom: 16px; }
  .toasts { left: 16px; right: 16px; bottom: 80px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 720px) {
  .footer nav { display: none; }
  .table--fit { min-width: 680px; }
  .footer__status { margin-left: auto; }
}
