:root {
  --ink: #17231f;
  --muted: #69746f;
  --paper: #fbfbf7;
  --surface: #ffffff;
  --line: #e3e7e1;
  --line-strong: #cfd7cf;
  --green: #3f7d45;
  --green-dark: #255c31;
  --green-soft: #eaf3e8;
  --blue: #2f6f9f;
  --navy: #15384a;
  --amber: #c48a37;
  --shadow: 0 18px 50px rgba(26, 45, 35, 0.10);
  --sidebar-width: 276px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.auth-gate {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 17% 10%, rgba(104, 170, 111, .24), transparent 29%),
    radial-gradient(circle at 88% 84%, rgba(47, 111, 159, .2), transparent 34%),
    linear-gradient(150deg, #153c32 0%, #102c2c 55%, #102630 100%);
}

.auth-card {
  width: min(470px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 22px;
  background: white;
  box-shadow: 0 34px 110px rgba(3, 17, 14, .38);
}

.auth-brand {
  padding: 24px 27px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
  background: linear-gradient(135deg, #153c32, #15384a);
}
.auth-brand h1 { margin: 3px 0 0; font: 600 22px/1 Georgia, serif; letter-spacing: -.02em; }
.auth-brand .brand-mark { flex: 0 0 auto; }
.auth-copy { padding: 32px 34px 10px; }
.auth-copy h2 { margin: 9px 0 12px; color: #21332a; font: 500 36px/1.08 Georgia, serif; letter-spacing: -.035em; }
.auth-copy > p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-form { padding: 10px 34px 4px; }
.auth-form label { display: block; margin: 13px 0 6px; color: #34483d; font-size: 10px; font-weight: 750; }
.auth-form input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #fbfcfa;
  font-size: 12px;
}
.auth-form input:focus { border-color: #7da17f; box-shadow: 0 0 0 3px rgba(63, 125, 69, .09); }
.auth-form .primary-button:disabled { cursor: wait; opacity: .58; }
.auth-form .form-status { color: #9a4f3b; }
.auth-note { margin: 13px 34px 28px; padding: 12px 13px; border-radius: 10px; color: #59705f; background: var(--green-soft); font-size: 9px; line-height: 1.5; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 27px 20px 19px;
  color: #edf4ef;
  background:
    radial-gradient(circle at 20% 4%, rgba(92, 153, 104, 0.22), transparent 30%),
    linear-gradient(160deg, #153c32 0%, #102c2c 58%, #102630 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block { display: flex; align-items: center; gap: 13px; padding: 0 7px; }
.brand-block h1 { margin: 2px 0 0; font: 600 16px/1.2 Georgia, serif; letter-spacing: -0.015em; }
.eyebrow { margin: 0; font-size: 10px; font-weight: 750; letter-spacing: 0.16em; text-transform: uppercase; color: #9fbbb0; }
.eyebrow.green { color: var(--green); }

.brand-mark {
  width: 39px;
  height: 39px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}
.brand-mark span { width: 4px; border-radius: 4px 4px 1px 1px; background: #8ec087; }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; }

.new-chat {
  width: 100%;
  margin: 30px 0 25px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: 150ms ease;
}
.new-chat:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.28); }
.new-chat span { font-size: 19px; line-height: 1; }

.nav-label { margin: 0 7px 9px; color: #829c93; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.conversation-item {
  width: 100%;
  padding: 11px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: #dfe9e3;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.conversation-item.active { background: rgba(128, 182, 132, 0.13); }
.conversation-item strong, .conversation-item small { display: block; }
.conversation-item strong { font-size: 12px; font-weight: 650; }
.conversation-item small { margin-top: 3px; color: #8fa89f; font-size: 10px; }
.conversation-icon { color: #8fba91; font-size: 16px; }
.sidebar-spacer { flex: 1; min-height: 24px; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #70c56f; box-shadow: 0 0 0 4px rgba(112, 197, 111, 0.09); }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 0 4px rgba(196, 138, 55, 0.10); }

.sidebar-action {
  width: 100%;
  margin-top: 10px;
  padding: 10px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  color: #a9bbb4;
  background: transparent;
  cursor: pointer;
}
.sidebar-action:hover { color: white; }
.privacy-note { margin: 13px 5px 0; color: #6f8980; font-size: 9px; line-height: 1.45; }

.main-panel {
  grid-column: 2;
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr) auto;
  background:
    linear-gradient(rgba(251, 251, 247, 0.93), rgba(251, 251, 247, 0.97)),
    radial-gradient(circle at 75% 10%, rgba(63, 125, 69, 0.09), transparent 33%);
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 247, 0.82);
  backdrop-filter: blur(14px);
}
.book-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.book-rule { display: block; width: 3px; height: 31px; border-radius: 3px; background: linear-gradient(var(--green), #6aa667); }
.book-title p { margin: 0 0 2px; color: var(--green); font-size: 9px; font-weight: 750; letter-spacing: 0.11em; text-transform: uppercase; }
.book-title h2 { margin: 0; font: 600 16px/1.2 Georgia, serif; color: #2b3531; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { position: relative; display: flex; align-items: center; gap: 10px; }
.mode-pill, .connection-badge {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  cursor: pointer;
}
.mode-pill { padding: 0 12px 0 8px; font-size: 11px; }
.mode-icon { width: 21px; height: 21px; display: grid; place-items: center; color: var(--green-dark); border-radius: 50%; background: var(--green-soft); font: 700 11px Georgia, serif; }
.chevron { color: #849089; font-size: 11px; }
.connection-badge { padding: 0 13px; color: #66716c; font-size: 10px; cursor: default; }
.connection-badge.connected { color: var(--green-dark); border-color: #cfe2ce; background: #f8fcf7; }
.user-chip {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5c6b63;
  font-size: 10px;
  font-weight: 650;
}
.mobile-menu { display: none; border: 0; background: transparent; font-size: 20px; }

.mode-menu {
  position: absolute;
  top: 43px;
  right: 132px;
  width: 250px;
  padding: 7px;
  display: none;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  box-shadow: var(--shadow);
}
.mode-menu.open { display: block; }
.mode-menu button { width: 100%; padding: 10px; text-align: left; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 12px; }
.mode-menu button:hover, .mode-menu button[aria-selected="true"] { background: var(--green-soft); color: var(--green-dark); }
.mode-menu small { display: block; margin-top: 3px; color: #7a8580; font-size: 10px; }
.mode-menu button:disabled { cursor: default; opacity: 0.5; background: #f5f6f4; color: #606b65; }
.mode-menu button:disabled:hover { background: #f5f6f4; color: #606b65; }

.chat-scroll { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.welcome { width: min(880px, calc(100% - 56px)); margin: 0 auto; padding: 8vh 0 42px; text-align: center; }
.welcome-orbit { width: 68px; height: 68px; margin: 0 auto 21px; display: grid; place-items: center; border: 1px solid #dbe5d9; border-radius: 50%; box-shadow: 0 0 0 9px rgba(74, 130, 76, 0.035), 0 0 0 18px rgba(74, 130, 76, 0.018); }
.welcome-core { width: 45px; height: 45px; display: grid; place-items: center; color: white; border-radius: 50%; background: linear-gradient(145deg, #376c42, #1e4f39); font: 600 17px Georgia, serif; letter-spacing: 0.03em; }
.welcome h2 { margin: 10px 0 13px; color: #1d2c26; font: 500 clamp(31px, 4vw, 46px)/1.06 Georgia, serif; letter-spacing: -0.035em; }
.welcome-copy { max-width: 610px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.65; }

.suggestions { margin-top: 39px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; text-align: left; }
.suggestion {
  min-height: 76px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.suggestion:hover { transform: translateY(-2px); border-color: #bfcdbf; box-shadow: 0 11px 28px rgba(35, 65, 43, 0.08); }
.suggestion-number { color: var(--green); font: 600 12px Georgia, serif; }
.suggestion strong, .suggestion small { display: block; }
.suggestion strong { font-size: 12px; font-weight: 650; }
.suggestion small { margin-top: 4px; color: #7b8580; font-size: 10px; }
.suggestion .arrow { color: #8aa08d; font-size: 15px; }

.messages { width: min(900px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 58px; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 13px; margin-bottom: 30px; animation: rise 220ms ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.message-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 11px; font-weight: 750; }
.message.user .message-avatar { color: var(--navy); background: #e5edf0; }
.message.assistant .message-avatar { color: white; background: linear-gradient(145deg, #3c7846, #245536); }
.message-meta { margin: 2px 0 8px; color: #7c8983; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.message-content { color: #27342f; font-size: 13px; line-height: 1.72; white-space: pre-wrap; }
.message.user .message-content { padding: 12px 15px; display: inline-block; border: 1px solid #dfe6e3; border-radius: 4px 14px 14px 14px; background: white; }
.message.assistant .message-content { padding: 2px 0; }
.message-content strong { font-weight: 700; }
.message-examples { margin-top: 22px; display: grid; grid-template-columns: 1fr; gap: 12px; }
.examples-heading { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 4px; }
.examples-heading strong { font: 600 20px/1.2 Georgia, serif; color: #22342a; }
.examples-heading span { color: #7b8881; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.example-card { min-width: 0; padding: 16px; border: 1px solid #dfe6dd; border-radius: 14px; background: linear-gradient(155deg, #fff, #fbfdf9); box-shadow: 0 10px 28px rgba(30, 58, 37, 0.06); }
.example-card header { display: flex; align-items: center; gap: 11px; }
.example-number { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: linear-gradient(145deg, #3c7846, #245536); font: 700 11px Georgia, serif; }
.example-card header small { display: block; color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.example-card h3 { margin: 3px 0 0; color: #26352d; font-size: 12px; }
.example-summary { margin: 13px 0 0; color: #56635d; font-size: 10px; line-height: 1.55; }
.worked-tables { margin-top: 15px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.data-table { min-width: 0; overflow: hidden; border: 1px solid #dce4df; border-radius: 11px; background: white; }
.data-table h4, .journal-block > h4 { margin: 0; padding: 10px 12px; color: #244d32; background: #edf5eb; font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; }
.data-table-grid { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); }
.data-table-grid > * { min-width: 0; padding: 7px 9px; border-top: 1px solid #edf0ed; overflow-wrap: anywhere; font-size: 8px; line-height: 1.35; }
.data-table-header { color: #32533d; background: #f7f9f6; font-weight: 800; text-transform: uppercase; letter-spacing: 0.035em; }
.data-table-grid span { color: #4d5c54; }
.journal-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.journal-block { overflow: hidden; border: 1px solid #dce4df; border-radius: 11px; background: #fbfcfa; }
.journal-block .entry-graphic { margin: 9px; }
.topic-map { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.topic-map > div { min-height: 66px; padding: 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; border: 1px solid #dce5dc; border-radius: 11px; background: linear-gradient(145deg, #fff, #f1f7ef); }
.topic-map small { color: #719078; font: 700 8px Georgia, serif; }
.topic-map strong { color: #2c4735; font-size: 9px; line-height: 1.35; }
.entry-graphic { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.entry-column { min-width: 0; overflow: hidden; border: 1px solid #dce4df; border-radius: 10px; background: white; }
.entry-column h4 { margin: 0; padding: 8px 9px; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.entry-column.debit h4 { color: #245d7b; background: #eaf3f8; }
.entry-column.credit h4 { color: #276a35; background: #eaf4e8; }
.entry-row { padding: 8px 9px; display: grid; gap: 3px; border-top: 1px solid #edf0ed; }
.entry-row strong { overflow-wrap: anywhere; color: #34423b; font-size: 9px; line-height: 1.35; }
.entry-row span { color: #68766f; font-size: 9px; font-variant-numeric: tabular-nums; }
.balance-badge { width: max-content; max-width: 100%; margin: 10px auto 0; padding: 5px 9px; border-radius: 12px; color: #2d6b38; background: #eaf4e8; font-size: 8px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.statement-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.statement-column, .income-statement, .simple-table, .rates-table { overflow: hidden; border: 1px solid #dce4df; border-radius: 11px; background: white; }
.statement-column h4, .income-statement h4, .simple-table h4, .rates-table h4 { margin: 0; padding: 10px 12px; color: #244d32; background: #edf5eb; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.statement-row, .simple-table > div, .rates-table > div { min-height: 31px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #edf0ed; }
.statement-row span, .simple-table span, .rates-table span { color: #4e5d55; font-size: 9px; line-height: 1.35; }
.statement-row strong, .simple-table strong, .rates-table b { flex: 0 0 auto; color: #283a30; font-size: 9px; font-variant-numeric: tabular-nums; }
.statement-row.group { min-height: 28px; background: #f5f7f4; }
.statement-row.group span { color: #2f6540; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.statement-row.total { color: white; background: #285f37; border-top-color: #285f37; }
.statement-row.total span, .statement-row.total strong { color: white; font-weight: 800; }
.statement-row.subtotal { background: #edf3f5; }
.statement-row.subtotal span, .statement-row.subtotal strong { color: #284d60; font-weight: 800; }
.statement-row.highlight { background: #fff4dc; }
.statement-row.highlight span, .statement-row.highlight strong { color: #75521b; font-weight: 800; }
.statement-row.deduction strong { color: #8a493f; }
.statement-row.addition strong { color: #2e7240; }
.income-statement { width: min(650px, 100%); margin: 16px auto 0; }
.conversion-top { margin-top: 16px; display: grid; grid-template-columns: 1fr 1.18fr; gap: 10px; }
.rates-table span strong, .rates-table span small { display: block; }
.rates-table span small { margin-top: 2px; color: #849088; font-size: 7px; }
.calculation-steps { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.calculation-steps > div { padding: 10px; display: grid; gap: 4px; border: 1px solid #dfe6dd; border-radius: 10px; background: #fbfcfa; }
.calculation-steps small { color: #6b7e72; font-size: 7px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.calculation-steps span { color: #56655d; font-size: 9px; }
.calculation-steps strong { color: #285f37; font-size: 11px; }
.example-conclusion { margin-top: 12px; padding: 11px 13px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #2d6a3b, #1e4c31); font-size: 10px; font-weight: 750; text-align: center; }
.ledger-graphic { margin-top: 14px; display: grid; grid-template-columns: .8fr 1fr 1.7fr .9fr .8fr; overflow: hidden; border: 1px solid #dce4df; border-radius: 10px; background: white; }
.ledger-graphic > div { min-width: 0; padding: 8px; border-left: 1px solid #e6ebe7; }
.ledger-graphic > div:first-child { border-left: 0; }
.ledger-graphic small, .ledger-graphic strong { display: block; overflow-wrap: anywhere; }
.ledger-graphic small { color: #5f7667; font-size: 7px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.ledger-graphic strong { margin-top: 5px; color: #34423b; font-size: 8px; line-height: 1.35; }
.concept-graphic { margin-top: 14px; display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; gap: 7px; color: #52725a; }
.concept-graphic span { height: 1px; background: linear-gradient(90deg, transparent, #9fbea3); }
.concept-graphic span:last-child { background: linear-gradient(90deg, #9fbea3, transparent); }
.concept-graphic i { padding: 6px 8px; border-radius: 8px; background: var(--green-soft); font-size: 8px; font-style: normal; font-weight: 750; text-transform: uppercase; }
.concept-graphic b { font-size: 12px; }
.message-notice { margin-top: 12px; }
.demo-flag { margin-top: 14px; padding: 9px 11px; display: inline-flex; align-items: center; gap: 7px; border-radius: 8px; color: #7a5523; background: #fff5e4; font-size: 10px; }

.financial-card { min-width: 0; padding: 16px; border: 1px solid #dfe6dd; border-radius: 14px; background: linear-gradient(155deg, #fff, #fbfdf9); box-shadow: 0 10px 28px rgba(30, 58, 37, 0.06); }
.financial-card header { display: flex; align-items: center; gap: 11px; }
.financial-badge { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: linear-gradient(145deg, #15384a, #245536); font: 700 11px Georgia, serif; }
.financial-card header small { display: block; color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.financial-card h3 { margin: 3px 0 0; color: #26352d; font-size: 12px; overflow-wrap: anywhere; }
.download-link { width: max-content; max-width: 100%; margin-top: 14px; padding: 8px 11px; display: inline-flex; border-radius: 10px; color: #245536; background: var(--green-soft); text-decoration: none; font-size: 10px; font-weight: 750; }
.statement-summary { margin-top: 13px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.statement-summary > div { padding: 9px; border: 1px solid #dce4df; border-radius: 10px; background: white; }
.statement-summary strong, .statement-summary span { display: block; }
.statement-summary strong { color: #2b4734; font-size: 9px; }
.statement-summary span { margin-top: 4px; color: #6d7a73; font-size: 8px; }
.metrics-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px; }
.metric-card { min-width: 0; padding: 11px; display: grid; gap: 5px; border: 1px solid #dce4df; border-radius: 11px; background: white; }
.metric-card small { color: #65756c; font-size: 8px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.metric-card strong { color: #244d32; font: 700 19px/1 Georgia, serif; }
.metric-card span { color: #51635a; font-size: 8px; }
.metric-card p { margin: 2px 0 0; color: #637168; font-size: 8px; line-height: 1.45; }
.metric-card.forte { background: linear-gradient(145deg, #fff, #f1f8ef); border-color: #cfdfcc; }
.metric-card.atenção { background: linear-gradient(145deg, #fff, #fff7e7); border-color: #ead7b5; }
.benchmark-panel { margin-top: 14px; padding: 12px; border: 1px solid #dce4df; border-radius: 13px; background: #fbfcfa; }
.benchmark-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.benchmark-panel h4 { margin: 0; color: #244d32; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.benchmark-panel header span { display: block; margin-top: 4px; color: #66756c; font-size: 9px; line-height: 1.45; }
.benchmark-panel header > strong { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #245536; background: var(--green-soft); font-size: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.benchmark-panel.amostra_insuficiente header > strong, .benchmark-panel.sem_benchmark header > strong { color: #7a5523; background: #fff1d7; }
.benchmark-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.benchmark-meta span { padding: 5px 7px; border: 1px solid #dde5df; border-radius: 999px; color: #596a61; background: white; font-size: 8px; }
.benchmark-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.benchmark-empty { margin: 10px 0 0; padding: 9px 10px; border: 1px solid #dbe7dc; border-radius: 10px; color: #52635a; background: #fbfef9; font-size: 8px; line-height: 1.45; }
.benchmark-item { min-width: 0; padding: 10px; border: 1px solid #e0e7e2; border-radius: 11px; background: white; }
.benchmark-item.acima_p75, .benchmark-item.abaixo_p25, .benchmark-item.ponto_atencao { border-color: #e0c2bc; background: #fff7f3; }
.benchmark-item.dentro_intervalo { border-color: #d6e5d4; background: #fbfef9; }
.benchmark-item.amostra_insuficiente, .benchmark-item.sem_benchmark, .benchmark-item.sem_dado { border-color: #ead7b5; background: #fffaf0; }
.benchmark-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.benchmark-item-top strong { color: #2f4338; font-size: 9px; line-height: 1.35; }
.benchmark-item-top span { flex: 0 0 auto; padding: 4px 6px; border-radius: 999px; color: #5f4c2c; background: #fff1d7; font-size: 7px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.benchmark-item.acima_p75 .benchmark-item-top span, .benchmark-item.abaixo_p25 .benchmark-item-top span, .benchmark-item.ponto_atencao .benchmark-item-top span { color: #743d2e; background: #ffe6de; }
.benchmark-item.dentro_intervalo .benchmark-item-top span { color: #2f6540; background: #eaf4e8; }
.benchmark-value { margin-top: 8px; display: flex; align-items: baseline; gap: 7px; }
.benchmark-value b { color: #244d32; font: 700 16px/1 Georgia, serif; }
.benchmark-value small { color: #78867e; font-size: 7px; text-transform: uppercase; letter-spacing: 0.06em; }
.benchmark-average { margin-top: 6px; color: #52635a; font-size: 8px; font-variant-numeric: tabular-nums; }
.benchmark-scatter { margin-top: 8px; padding: 7px 7px 5px; border: 1px solid #e5ebe6; border-radius: 9px; background: linear-gradient(145deg, #fff, #f9fbf8); }
.benchmark-scatter svg { display: block; width: 100%; height: auto; overflow: visible; }
.scatter-axis { stroke: #d7e0d9; stroke-width: 1; }
.scatter-mean { stroke: #c48a37; stroke-width: 1.3; stroke-dasharray: 4 3; }
.scatter-deviation { stroke: #b15b3d; stroke-width: 1.1; stroke-dasharray: 2 2; opacity: .72; }
.scatter-dot.sample { fill: #a9c7ad; stroke: white; stroke-width: 1; opacity: .82; }
.scatter-dot.current { fill: #245536; stroke: white; stroke-width: 1.8; filter: drop-shadow(0 2px 3px rgba(18, 54, 34, .22)); }
.scatter-dot.current.attention { fill: #b15b3d; }
.benchmark-scatter-legend { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; color: #78867e; font-size: 7px; text-transform: uppercase; letter-spacing: 0.05em; }
.benchmark-scatter-legend span { display: inline-flex; align-items: center; gap: 4px; }
.benchmark-scatter-legend i { width: 13px; height: 1px; border-radius: 0; background: #c48a37; }
.benchmark-scatter-legend span:nth-child(2) i { width: 7px; height: 7px; border-radius: 50%; background: #245536; }
.benchmark-item p { margin: 6px 0 0; color: #66746c; font-size: 8px; line-height: 1.45; }
.internal-alert-panel { margin-top: 14px; padding: 12px; border: 1px solid #dce4df; border-radius: 13px; background: linear-gradient(145deg, #fbfcfa, #fffdf8); }
.internal-alert-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.internal-alert-panel h4 { margin: 0; color: #244d32; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.internal-alert-panel header span { display: block; margin-top: 4px; color: #66756c; font-size: 9px; line-height: 1.45; }
.internal-alert-panel header > strong { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #743d2e; background: #ffe6de; font-size: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.internal-alert-panel.sem-alertas header > strong { color: #2f6540; background: #eaf4e8; }
.internal-alert-group { margin-top: 10px; }
.internal-alert-group h5 { margin: 0 0 7px; color: #52635a; font-size: 8px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.internal-alert-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.internal-alert-group .internal-alert-grid { margin-top: 0; }
.internal-alert-item { min-width: 0; padding: 10px; border: 1px solid #e5decf; border-radius: 11px; background: #fffaf0; box-shadow: 0 1px 0 rgba(36, 77, 50, 0.03); }
.internal-alert-item.alto { border-color: #e0c2bc; background: #fff4ef; }
.internal-alert-item.baixo { border-color: #d9e4d7; background: #fbfef9; }
.internal-alert-item.sem-alerta { border-color: #d6e5d4; background: #fbfef9; }
.internal-alert-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.internal-alert-top strong { color: #5c3c2d; font-size: 9px; line-height: 1.35; }
.internal-alert-item.baixo .internal-alert-top strong, .internal-alert-item.sem-alerta .internal-alert-top strong { color: #2f6540; }
.internal-alert-top span { flex: 0 0 auto; padding: 4px 6px; border-radius: 999px; color: #743d2e; background: #ffe6de; font-size: 7px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.internal-alert-item.medio .internal-alert-top span, .internal-alert-item.médio .internal-alert-top span { color: #7a5523; background: #fff1d7; }
.internal-alert-item.baixo .internal-alert-top span, .internal-alert-item.sem-alerta .internal-alert-top span { color: #2f6540; background: #eaf4e8; }
.internal-alert-item p { margin: 7px 0 0; color: #6c5b4b; font-size: 8px; line-height: 1.5; }
.internal-alert-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.internal-alert-meta span { padding: 4px 6px; border: 1px solid #e2e8e3; border-radius: 999px; color: #66756c; background: rgba(255, 255, 255, .74); font-size: 7px; text-transform: uppercase; letter-spacing: 0.04em; }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 22px; }
.typing span { width: 5px; height: 5px; border-radius: 50%; background: #6d9d73; animation: pulse 1s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 140ms; }
.typing span:nth-child(3) { animation-delay: 280ms; }
@keyframes pulse { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.composer-area { padding: 0 30px 17px; background: linear-gradient(to top, var(--paper) 80%, rgba(251, 251, 247, 0)); }
.composer { width: min(900px, 100%); margin: 0 auto; padding: 13px 13px 10px 17px; border: 1px solid var(--line-strong); border-radius: 16px; background: white; box-shadow: 0 11px 36px rgba(38, 55, 46, 0.09); }
.composer:focus-within { border-color: #8eae90; box-shadow: 0 11px 38px rgba(49, 91, 57, 0.13); }
.composer textarea { width: 100%; max-height: 150px; resize: none; padding: 2px 2px 10px; color: var(--ink); border: 0; outline: none; background: transparent; font-size: 13px; line-height: 1.5; }
.composer textarea::placeholder { color: #929c97; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.composer-tools { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-hint { display: flex; align-items: center; gap: 6px; color: #8a948f; font-size: 9px; }
.answer-symbol { color: var(--green); font-size: 10px; }
.attach-button { height: 29px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfded0; border-radius: 9px; color: var(--green-dark); background: var(--green-soft); cursor: pointer; font-size: 9px; font-weight: 750; }
.attach-button:hover { border-color: #acc4ad; background: #deeedb; }
.file-chip { max-width: 230px; padding: 6px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #dce4df; border-radius: 999px; color: #506158; background: #fbfcfa; font-size: 9px; }
.send-button { height: 31px; padding: 0 11px 0 13px; display: inline-flex; align-items: center; gap: 9px; border: 0; border-radius: 9px; color: white; background: var(--green-dark); cursor: pointer; font-size: 10px; font-weight: 650; }
.send-button:hover { background: #1d4c29; }
.send-button:disabled { cursor: wait; opacity: 0.55; }
.disclaimer { margin: 8px auto 0; text-align: center; color: #939d98; font-size: 8px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(9, 28, 24, 0.56); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(480px, 100%); padding: 31px; border-radius: 18px; background: #fff; box-shadow: 0 28px 90px rgba(6, 24, 19, 0.25); }
.modal h2 { margin: 8px 0 10px; font: 500 28px/1.12 Georgia, serif; letter-spacing: -0.025em; }
.modal-copy { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.modal-close { position: absolute; top: 13px; right: 14px; width: 31px; height: 31px; border: 0; border-radius: 50%; color: #67736d; background: #f1f4f1; cursor: pointer; font-size: 20px; }
.modal form label { display: block; margin: 14px 0 6px; font-size: 10px; font-weight: 700; }
.modal input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; background: #fbfcfa; font-size: 12px; }
.modal input:focus { border-color: #87a988; }
.provider-options { display: grid; gap: 9px; margin: 18px 0 8px; }
.provider-card {
  position: relative;
  min-height: 66px;
  margin: 0 !important;
  padding: 11px 12px;
  display: grid !important;
  grid-template-columns: 35px minmax(0, 1fr) 21px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfa;
  cursor: pointer;
}
.provider-card:has(input:checked) { border-color: #8caf8e; background: #f3f8f2; box-shadow: 0 0 0 2px rgba(63, 125, 69, 0.07); }
.provider-card input { position: absolute; opacity: 0; pointer-events: none; }
.provider-card strong, .provider-card small { display: block; }
.provider-card strong { color: #26332d; font-size: 11px; }
.provider-card small { margin-top: 4px; color: #77847d; font-size: 9px; font-weight: 500; }
.provider-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; font-size: 16px; }
.provider-icon.local { color: var(--green-dark); background: var(--green-soft); }
.provider-icon.cloud { color: var(--blue); background: #e9f1f7; }
.provider-check { width: 19px; height: 19px; display: none; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 10px; }
.provider-card:has(input:checked) .provider-check { display: grid; }
#openai-fields[hidden] { display: none; }
.primary-button { width: 100%; height: 42px; margin-top: 18px; border: 0; border-radius: 9px; color: white; background: var(--green-dark); cursor: pointer; font-weight: 650; font-size: 12px; }
.form-status { min-height: 16px; margin: 8px 0 0; text-align: center; color: var(--green); font-size: 10px; }
.modal-note { margin-top: 17px; padding: 12px 13px; border-radius: 9px; background: var(--green-soft); }
.modal-note strong { color: var(--green-dark); font-size: 10px; }
.modal-note p { margin: 4px 0 0; color: #5f7262; font-size: 10px; line-height: 1.5; }

@media (max-width: 880px) {
  :root { --sidebar-width: 250px; }
  .sidebar { transform: translateX(-100%); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 55px rgba(11, 32, 27, 0.24); }
  .main-panel { grid-column: 1 / -1; }
  .mobile-menu { display: block; }
  .topbar { padding: 0 20px; justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .connection-badge span:last-child { display: none; }
  .connection-badge { width: 34px; justify-content: center; padding: 0; }
  .mode-menu { right: 38px; }
}

@media (max-width: 620px) {
  .auth-gate { padding: 14px; }
  .auth-copy { padding: 27px 24px 8px; }
  .auth-copy h2 { font-size: 31px; }
  .auth-form { padding: 9px 24px 3px; }
  .auth-note { margin: 13px 24px 24px; }
  .main-panel { grid-template-rows: 64px minmax(0, 1fr) auto; }
  .book-title p { display: none; }
  .book-title h2 { max-width: 165px; font-size: 13px; }
  .mode-pill { width: 34px; padding: 0; justify-content: center; }
  .mode-pill > span:not(.mode-icon) { display: none; }
  .mode-menu { right: 0; }
  .user-chip { display: none; }
  .welcome { width: calc(100% - 30px); padding-top: 7vh; }
  .welcome h2 { font-size: 32px; }
  .suggestions { grid-template-columns: 1fr; margin-top: 29px; }
  .suggestion { min-height: 67px; }
  .messages { width: calc(100% - 28px); }
  .message-examples { grid-template-columns: 1fr; }
  .statement-grid, .conversion-top, .calculation-steps, .worked-tables, .journal-grid { grid-template-columns: 1fr; }
  .metrics-grid, .statement-summary { grid-template-columns: 1fr; }
  .ledger-graphic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-graphic > div { border-top: 1px solid #e6ebe7; }
  .composer-area { padding: 0 12px 10px; }
  .composer-hint span:last-child { display: none; }
  .disclaimer { display: none; }
}
