:root {
  font-family: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171829;
  background: #f6f6fb;
  font-synthesis: none;
  color-scheme: light;
  --background: #f6f6fb;
  --surface: #fff;
  --ink: #171829;
  --muted: #5e6176;
  --line: #e5e5ef;
  --subtle: #f3f2fa;
  --accent: #5540c4;
  --accent-hover: #4631b2;
  --sidebar: #151428;
  --danger: #a0264b;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid #8472ee; outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: block;
  width: 36px;
  height: auto;
  flex: 0 0 auto;
}
.brand-wordmark { display: block; width: 79px; height: auto; }
.brand-name > span { display: block; margin-top: 3px; color: #c1bfd7; font-size: 12px; line-height: 1.25; }
.startup, .auth-screen {
  display: grid;
  place-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
}
.startup { justify-items: center; gap: 17px; color: var(--muted); text-align: center; }
.auth-screen { background: radial-gradient(ellipse at 55% -10%, #e6ddff 0%, transparent 68%), var(--background); }
.auth-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: clamp(24px, 6vw, 42px);
  box-shadow: 0 21px 56px #2e215918;
}
.auth-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--sidebar);
}
.environment-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid #e1ddf5;
  border-radius: 6px;
  color: #52428b;
  background: #f1edfd;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.4;
}
.environment-badge[data-environment="homolog"] {
  border-color: #f0d597;
  color: #724500;
  background: #fff3d6;
}
.auth-card h1 { font-size: clamp(24px, 6vw, 29px); letter-spacing: -.045em; line-height: 1.16; }
.auth-card > p { margin: 12px 0 27px; color: var(--muted); line-height: 1.55; font-size: 14px; }
.auth-card form { display: grid; gap: 17px; }
.auth-card .button { width: 100%; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar {
  display: flex;
  flex-direction: column;
  align-self: start;
  position: sticky;
  top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  gap: 42px;
  padding: 30px 18px 16px;
  background: var(--sidebar);
  color: #f9f7ff;
}
.sidebar .brand { margin-left: 9px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #ffffff20; padding-top: 13px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #d9d6ed;
  text-decoration: none;
  text-align: left;
  font-size: 14px;
  font-weight: 590;
}
.nav-link:hover { background: #ffffff0d; color: #fff; }
.nav-link[aria-current] { color: #f3edff; background: #6e56ed2b; border-color: #a58bf728; }
.content { width: 100%; max-width: 1394px; justify-self: center; padding: 56px clamp(24px, 4.2vw, 68px); }
.workspace-context {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 8px 16px;
  margin-bottom: 15px;
}
.workspace-account {
  margin-left: auto;
  max-width: min(100%, 32rem);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.workspace-account strong { margin-left: 4px; color: var(--ink); font-weight: 650; }
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.content-header h1 { font-size: clamp(35px, 5vw, 47px); letter-spacing: -.06em; font-weight: 730; line-height: 1.09; }
.content-header p { color: var(--muted); font-size: 15px; line-height: 1.55; margin-top: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 42px;
  border-radius: 9px;
  padding: 9px 15px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 660;
  line-height: 1.4;
  text-align: center;
  transition: background .14s ease, border-color .14s ease;
}
.primary { color: #fff; background: var(--accent); box-shadow: 0 1px 2px #3824701a; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { color: var(--ink); background: var(--surface); border-color: #dcdce8; }
.secondary:hover:not(:disabled) { background: var(--subtle); }
.icon { display: inline-block; position: relative; width: 16px; height: 16px; flex: 0 0 auto; }
.icon::before, .icon::after { content: ""; position: absolute; }
.icon-plus::before, .icon-plus::after, .icon-close::before, .icon-close::after {
  border-radius: 1px;
  background: currentColor;
  width: 13px;
  height: 1.6px;
  top: 7px;
  left: 1.5px;
}
.icon-plus::after { transform: rotate(90deg); }
.icon-close::before { transform: rotate(45deg); }
.icon-close::after { transform: rotate(-45deg); }
.icon-search::before { width: 11px; height: 11px; border: 1.6px solid currentColor; border-radius: 50%; left: 0; top: 0; }
.icon-search::after { width: 6px; height: 1.6px; border-radius: 1px; background: currentColor; transform: rotate(45deg); top: 11px; left: 8px; }
.icon-workspace::before { inset: 2px 0 1px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-workspace::after { inset: 5px 1px auto; height: 1.5px; background: currentColor; }
.icon-exit::before { inset: 1px 5px 1px 1px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 3px; }
.icon-exit::after { top: 5px; right: 0; width: 7px; height: 7px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); }
.icon-tools::before { inset: 1px 7px 7px 1px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-tools::after { inset: 7px 1px 1px 7px; border: 1.5px solid currentColor; border-radius: 3px; background: var(--sidebar); }
.icon-activity::before { inset: 0 0 auto 1px; width: 11px; height: 11px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-activity::after { top: 4px; left: 5px; width: 3px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.registry { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 2px 4px #19182d04; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 17px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.toolbar h2 { font-size: 17px; letter-spacing: -.026em; }
.count { color: var(--muted); font-size: 13px; margin-top: 4px; }
.count:empty { display: none; }
.search { display: flex; align-items: center; gap: 8px; width: min(100%, 260px); border: 1px solid #dedeea; border-radius: 9px; padding-inline: 11px; color: var(--muted); }
.search:focus-within { outline: 2px solid #8472ee; outline-offset: 1px; }
.search input {
  height: 39px;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}
.search input::placeholder, .field input::placeholder { color: #71748b; }
.search input:disabled { opacity: .65; }
.list-status { display: grid; justify-items: center; align-content: center; min-height: 300px; padding: 40px 18px; text-align: center; }
.state-icon {
  display: grid;
  place-items: center;
  width: 53px;
  height: 53px;
  margin-bottom: 17px;
  border: 1px solid #e7e0fc;
  border-radius: 15px;
  color: var(--accent);
  background: #f2edfe;
}
.state-icon .icon { transform: scale(1.3); }
.state-title { font-weight: 690; font-size: 17px; letter-spacing: -.02em; }
.state-detail { max-width: 36ch; margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.state-detail:empty { display: none; }
.list-status .button { margin-top: 19px; }
.workspace-notice { margin: 15px 24px 0; color: #185e45; background: #eaf8f2; border: 1px solid #d0ece0; border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.workspace-notice.error { color: var(--danger); background: #fff2f6; border-color: #f4d7e2; }
.table-wrap { overflow: auto; padding-bottom: 4px; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 14px 12px; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 660; background: #fafafd; }
td { font-size: 14px; color: #414459; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { text-align: right; padding-right: 24px; }
.name-group { display: flex; align-items: center; gap: 11px; }
.name-group strong { display: block; color: var(--ink); font-weight: 650; }
.name-group small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.client-initials { display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 33px; background: #edeafa; color: #50438a; border-radius: 8px; font-weight: 710; font-size: 12px; }
.tool-chip { display: inline-block; color: #5540a6; background: #f2edfe; border-radius: 6px; padding: 5px 8px; font-size: 12px; font-weight: 630; }
.muted { color: var(--muted); }
.edit-button { min-height: 36px; font-size: 13px; }
.actions-cell { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tools-toggle { min-height: 36px; font-size: 13px; }
.tools-row td { padding: 0; border-top: 0; }
.tools-panel { margin: 0 24px 20px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--subtle); }
.tools-panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tools-panel-header h3 { font-size: 14px; font-weight: 660; }
.tool-instance-list { display: grid; gap: 10px; }
.tool-instance { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.tool-instance-identity { display: grid; gap: 2px; min-width: 160px; flex: 1 1 200px; }
.tool-instance-identity strong { font-size: 14px; font-weight: 650; }
.tool-instance-identity small { color: var(--muted); font-size: 12px; }
.tools-empty, .tools-loading, .tools-error { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.token-reveal {
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
}
.account-role-badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 660; color: #52428b; background: #f1edfd; }
.account-status-pending { color: var(--muted); }
.tools-error { color: var(--danger); }
.tool-check-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
.tool-check-row:has(input:disabled) { opacity: .65; cursor: wait; }
.tool-check-row input[type="checkbox"] { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--accent); }
.tool-check-row-label { display: grid; gap: 2px; }
.tool-check-row-label strong { font-size: 14px; font-weight: 650; }
.tool-check-row-label small { color: var(--muted); font-size: 12px; }
.integration-add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.integration-add-row select {
  flex: 1 1 160px;
  height: 40px;
  padding-inline: 10px;
  border: 1px solid #dcdce8;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
}
.integration-add-row input {
  flex: 2 1 220px;
  height: 40px;
  padding-inline: 10px;
  border: 1px solid #dcdce8;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
}
.field textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 11px;
  border: 1px solid #dcdce8;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  resize: vertical;
}
dialog {
  width: min(94vw, 530px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #dedee8;
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 90px #17112f2e;
}
dialog::backdrop { background: #141124aa; }
.dialog-header, .dialog-footer { display: flex; gap: 12px; align-items: start; justify-content: space-between; padding: 20px 24px; }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 24px; letter-spacing: -.045em; }
.dialog-header p { margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.dialog-body { display: grid; gap: 17px; padding: 21px 24px; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.icon-button { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: var(--subtle); }
.icon-button:hover { background: #e9e3fa; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 630; }
.field small, .check-card small { color: var(--muted); line-height: 1.45; font-size: 12px; font-weight: 450; }
.field > span small { margin-left: 4px; }
.field input {
  width: 100%;
  height: 42px;
  min-width: 0;
  padding-inline: 11px;
  border: 1px solid #dcdce8;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  font-weight: 450;
}
.color-field { display: flex; gap: 8px; }
.color-field input[type="color"] { width: 52px; padding: 5px; cursor: pointer; }
.color-field input[type="text"] { max-width: 118px; }
fieldset { padding: 0; border: 0; margin: 0; }
legend { margin-bottom: 7px; padding: 0; font-size: 14px; font-weight: 630; }
.check-card { display: flex; gap: 9px; align-items: start; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; cursor: pointer; }
.check-card input { margin: 3px 0 0; accent-color: var(--accent); width: 16px; height: 16px; }
.check-card strong, .check-card small { display: block; }
.check-card strong { font-size: 14px; font-weight: 630; }
.check-card small { margin-top: 3px; }
.form-error, .form-note { border-radius: 8px; padding: 9px 11px; font-size: 13px; line-height: 1.5; }
.form-error { color: var(--danger); background: #fff2f6; }
.form-note { color: var(--muted); background: var(--subtle); }

@media (max-width: 820px) {
  .layout { display: block; }
  .sidebar { position: static; min-height: auto; flex-direction: row; align-items: center; gap: 20px; padding: 12px 18px; }
  .sidebar .brand { margin: 0; }
  .sidebar-footer { margin: 0 0 0 auto; border: 0; padding: 0; }
  .content { padding: 35px 22px; }
  .content-header { margin-bottom: 24px; }
  .brand-mark { width: 32px; }
  .sidebar .brand-wordmark { width: 70px; }
}
@media (max-width: 560px) {
  .content { padding-inline: 16px; }
  .workspace-account { margin-left: 0; }
  .content-header { display: grid; justify-items: start; gap: 14px; }
  .toolbar { flex-direction: column; align-items: stretch; padding: 16px; }
  .search { width: 100%; }
  .sidebar { gap: 8px; padding-inline: 11px; }
  .sidebar .brand { gap: 7px; }
  .sidebar .nav-link { min-height: 40px; gap: 5px; padding: 7px; font-size: 13px; }
  .sidebar .nav-link .icon { display: none; }
  .workspace-notice { margin-inline: 16px; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  tr { padding: 14px 16px; }
  tbody tr + tr { border-top: 1px solid var(--line); }
  td, td:first-child, td:last-child { padding: 6px 0; border: 0; text-align: left; }
  td[data-label]::before { content: attr(data-label); display: block; padding-bottom: 3px; font-size: 12px; font-weight: 650; color: var(--muted); }
  .dialog-body, .dialog-header, .dialog-footer { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }

/* Portal: cards de ferramentas e seção de equipe. */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding: 20px 24px; }
.tool-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
}
.tool-card.is-launchable { cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease; }
.tool-card.is-launchable:hover { border-color: #c7bdf0; box-shadow: 0 6px 18px #2e215914; }
.tool-card:disabled, .tool-card.is-disabled { cursor: not-allowed; opacity: .68; }
.tool-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: var(--accent);
  background: #f2edfe;
  font-weight: 710;
  font-size: 16px;
}
.tool-card h3 { font-size: 16px; font-weight: 660; letter-spacing: -.01em; }
.tool-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.tool-card-note { color: var(--muted); font-size: 12px; font-style: italic; }
.section-divider { margin: 36px 24px 0; padding-top: 28px; border-top: 1px solid var(--line); }
.account-row-self { border-color: #c7bdf0; }
.role-select { height: 42px; padding-inline: 10px; border: 1px solid #dcdce8; border-radius: 8px; color: var(--ink); background: var(--surface); font-size: 14px; }

/* Convite com link copiável (P3) */
.button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.field-inline { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 14px; }
input.token-reveal { width: 100%; box-sizing: border-box; padding: 10px 12px; }

.visually-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
