:root {
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --graphite-950: #111827;
  --graphite-900: #172033;
  --graphite-800: #243149;
  --graphite-700: #334155;
  --graphite-600: #475569;
  --graphite-500: #64748b;
  --graphite-400: #94a3b8;
  --graphite-300: #cbd5e1;
  --graphite-200: #e2e8f0;
  --graphite-100: #f1f5f9;
  --surface: #ffffff;
  --canvas: #f4f6f9;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --sidebar-width: 264px;
  --header-height: 72px;
  --radius: 16px;
  --shadow: 0 12px 30px rgb(15 23 42 / 8%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--graphite-950);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 5%, rgb(249 115 22 / 22%), transparent 27%),
    linear-gradient(180deg, #172033 0%, #101827 100%);
  color: var(--surface);
  box-shadow: 12px 0 32px rgb(15 23 42 / 12%);
  transition: transform 180ms ease;
}

.sidebar-brand {
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  gap: 12px;
  padding: 15px 22px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.brand-mark span {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #fed7aa;
  border-radius: 50%;
  background: var(--orange-500);
  box-shadow: 0 0 0 3px rgb(249 115 22 / 14%);
}

.brand-mark span:nth-child(1) {
  top: 2px;
  left: 14px;
}

.brand-mark span:nth-child(2) {
  right: 1px;
  bottom: 4px;
}

.brand-mark span:nth-child(3) {
  bottom: 4px;
  left: 1px;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  height: 2px;
  background: var(--orange-400);
  transform-origin: left center;
}

.brand-mark::before {
  top: 14px;
  left: 9px;
  width: 25px;
  transform: rotate(36deg);
}

.brand-mark::after {
  bottom: 12px;
  left: 8px;
  width: 25px;
  transform: rotate(-36deg);
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  display: block;
  overflow: hidden;
  font-size: 1.03rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
}

.brand-tagline {
  display: block;
  margin-top: 2px;
  color: var(--graphite-400);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-context {
  margin: 18px 16px 8px;
  padding: 13px 14px;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 12px;
  background: rgb(255 255 255 / 4%);
}

.context-label {
  display: block;
  color: var(--graphite-400);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.context-name {
  display: block;
  margin-top: 5px;
  font-size: 0.86rem;
  font-weight: 700;
}

.context-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: #bbf7d0;
  font-size: 0.72rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgb(34 197 94 / 13%);
}

.sidebar-nav {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
}

.nav-caption {
  padding: 10px 12px 4px;
  color: var(--graphite-500);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 13px;
  border-radius: 11px;
  color: var(--graphite-300);
  font-size: 0.88rem;
  font-weight: 650;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.nav-link:hover {
  background: rgb(255 255 255 / 6%);
  color: var(--surface);
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(90deg, rgb(249 115 22 / 25%), rgb(249 115 22 / 8%));
  color: var(--surface);
}

.nav-link.active::before {
  position: absolute;
  inset: 8px auto 8px -14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--orange-500);
  content: "";
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--graphite-400);
}

.nav-link.active .nav-icon {
  color: var(--orange-400);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

.nav-link.disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.coming-soon {
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 7%);
  color: var(--graphite-400);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid rgb(255 255 255 / 7%);
}

.sidebar-footer strong,
.sidebar-footer small {
  display: block;
}

.sidebar-footer strong {
  font-size: 0.75rem;
}

.sidebar-footer small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.67rem;
}

.app-workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 30px;
  border-bottom: 1px solid var(--graphite-200);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right,
.user-area {
  display: flex;
  align-items: center;
}

.topbar-left {
  min-width: 0;
  gap: 14px;
}

.topbar-right {
  gap: 14px;
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  overflow: hidden;
  margin: 0;
  font-size: 1.03rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-heading p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--graphite-500);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-menu,
.icon-button,
.password-toggle,
.flash-close {
  display: grid;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.mobile-menu {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  color: var(--graphite-700);
}

.environment-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.7rem;
  font-weight: 800;
}

.user-area {
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--graphite-200);
}

.user-copy {
  text-align: right;
}

.user-copy strong,
.user-copy small {
  display: block;
}

.user-copy strong {
  font-size: 0.78rem;
}

.user-copy small {
  margin-top: 2px;
  color: var(--graphite-500);
  font-size: 0.66rem;
}

.user-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  border: 2px solid var(--orange-100);
  border-radius: 12px;
  background: var(--orange-500);
  color: var(--surface);
  font-size: 0.78rem;
  font-weight: 900;
  place-items: center;
}

.logout-form {
  margin: 0;
}

.logout-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--graphite-200);
  border-radius: 9px;
  background: var(--surface);
  color: var(--graphite-500);
  cursor: pointer;
  place-items: center;
}

.logout-button:hover {
  border-color: #fecaca;
  color: var(--danger);
}

.logout-button svg {
  width: 16px;
  height: 16px;
}

.page-content {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 28px 30px 42px;
}

.content-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--orange-600);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.content-intro h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: -0.035em;
}

.content-intro p {
  max-width: 700px;
  margin: 7px 0 0;
  color: var(--graphite-500);
  font-size: 0.86rem;
  line-height: 1.6;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.primary-button {
  border: 1px solid var(--orange-500);
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: var(--surface);
  box-shadow: 0 8px 18px rgb(234 88 12 / 20%);
}

.primary-button:hover {
  box-shadow: 0 12px 22px rgb(234 88 12 / 27%);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.secondary-button {
  border: 1px solid var(--graphite-200);
  background: var(--surface);
  color: var(--graphite-700);
}

.button-icon,
.primary-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--graphite-200);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card::after {
  position: absolute;
  right: -30px;
  bottom: -45px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--metric-tint, var(--orange-50));
  content: "";
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  color: var(--graphite-500);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metric-icon {
  display: grid;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--metric-tint, var(--orange-50));
  color: var(--metric-color, var(--orange-600));
  place-items: center;
}

.metric-icon svg {
  width: 18px;
  height: 18px;
}

.metric-value {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 11px;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.metric-help {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 4px;
  color: var(--graphite-500);
  font-size: 0.72rem;
}

.metric-card.orange {
  --metric-color: #ea580c;
  --metric-tint: #fff1e6;
}

.metric-card.blue {
  --metric-color: #0284c7;
  --metric-tint: #e0f2fe;
}

.metric-card.green {
  --metric-color: #16a34a;
  --metric-tint: #dcfce7;
}

.metric-card.violet {
  --metric-color: #7c3aed;
  --metric-tint: #ede9fe;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 18px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--graphite-200);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--graphite-100);
}

.panel-header h3 {
  margin: 0;
  font-size: 0.94rem;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--graphite-500);
  font-size: 0.72rem;
  line-height: 1.45;
}

.panel-link {
  flex: 0 0 auto;
  color: var(--orange-600);
  font-size: 0.72rem;
  font-weight: 800;
}

.panel-link:hover {
  color: var(--orange-700);
}

.panel-body {
  padding: 22px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--graphite-100);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  background: #fafbfc;
  color: var(--graphite-500);
  font-size: 0.63rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.data-table td {
  color: var(--graphite-700);
  font-size: 0.76rem;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.agent-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-agent-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--orange-50);
  color: var(--orange-600);
  font-size: 0.62rem;
  font-weight: 900;
  place-items: center;
}

.agent-cell strong,
.agent-cell small {
  display: block;
}

.agent-cell strong {
  color: var(--graphite-900);
  font-size: 0.76rem;
}

.agent-cell small {
  max-width: 280px;
  overflow: hidden;
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.67rem;
  text-overflow: ellipsis;
}

.status-badge,
.role-badge,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.63rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge {
  gap: 6px;
  padding: 5px 9px;
  background: #f0fdf4;
  color: #15803d;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  content: "";
}

.role-badge {
  padding: 5px 9px;
  background: var(--graphite-100);
  color: var(--graphite-600);
}

.tag {
  padding: 5px 9px;
  background: var(--orange-50);
  color: var(--orange-700);
}

.org-map {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgb(249 115 22 / 9%), transparent 30%),
    linear-gradient(var(--graphite-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--graphite-100) 1px, transparent 1px);
  background-size:
    auto,
    24px 24px,
    24px 24px;
}

.org-map::before {
  position: absolute;
  top: 87px;
  left: 50%;
  width: 2px;
  height: 70px;
  background: var(--graphite-300);
  content: "";
}

.org-map::after {
  position: absolute;
  top: 156px;
  left: 27%;
  width: 46%;
  height: 2px;
  background: var(--graphite-300);
  content: "";
}

.org-node {
  position: absolute;
  z-index: 2;
  width: 118px;
  padding: 11px 9px;
  border: 1px solid var(--graphite-200);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgb(15 23 42 / 8%);
  text-align: center;
}

.org-node strong,
.org-node small {
  display: block;
}

.org-node strong {
  color: var(--graphite-900);
  font-size: 0.74rem;
}

.org-node small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.62rem;
}

.org-node.root {
  top: 42px;
  left: 50%;
  border-color: var(--orange-400);
  background: var(--orange-50);
  transform: translateX(-50%);
}

.org-node.child-one {
  top: 173px;
  left: 13%;
}

.org-node.child-two {
  top: 173px;
  left: 50%;
  transform: translateX(-50%);
}

.org-node.independent {
  top: 173px;
  right: 13%;
  border-style: dashed;
}

.org-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--graphite-100);
  color: var(--graphite-500);
  font-size: 0.65rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 18px;
  height: 2px;
  background: var(--graphite-300);
}

.legend-line.dashed {
  border-top: 2px dashed var(--graphite-400);
  background: transparent;
}

.standards-list {
  display: grid;
  gap: 10px;
}

.standard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 13px;
  border: 1px solid var(--graphite-100);
  border-radius: 10px;
  background: #fafbfc;
}

.standard-item span {
  color: var(--graphite-500);
  font-size: 0.69rem;
  font-weight: 700;
}

.standard-item strong {
  font-size: 0.73rem;
  text-align: right;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash-message {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--graphite-200);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgb(15 23 42 / 5%);
  font-size: 0.76rem;
  line-height: 1.5;
}

.flash-message.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.flash-message.error,
.flash-message.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.flash-message.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.flash-message.info {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

.flash-close {
  width: 24px;
  height: 24px;
  margin-left: auto;
  color: currentColor;
  opacity: 0.55;
}

.flash-close:hover {
  opacity: 1;
}

.agents-layout {
  display: grid;
  grid-template-columns: minmax(310px, 0.8fr) minmax(0, 1.5fr);
  gap: 18px;
}

.tree-panel {
  align-self: start;
}

.agent-tree,
.agent-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-tree ul {
  position: relative;
  margin: 9px 0 0 20px;
  padding-left: 20px;
  border-left: 1px solid var(--graphite-300);
}

.agent-tree li {
  position: relative;
  margin-bottom: 9px;
}

.agent-tree ul > li::before {
  position: absolute;
  top: 21px;
  left: -20px;
  width: 16px;
  height: 1px;
  background: var(--graphite-300);
  content: "";
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 11px;
  background: var(--surface);
}

.tree-node.entrypoint {
  border-color: var(--orange-300, #fdba74);
  background: var(--orange-50);
}

.tree-node strong,
.tree-node small {
  display: block;
}

.tree-node strong {
  font-size: 0.74rem;
}

.tree-node small {
  margin-top: 2px;
  color: var(--graphite-500);
  font-size: 0.63rem;
}

.tree-node .tree-type {
  margin-left: auto;
  color: var(--graphite-400);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.independent-group {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px dashed var(--graphite-300);
}

.independent-label {
  display: block;
  margin-bottom: 9px;
  color: var(--graphite-500);
  font-size: 0.63rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.agent-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.agent-card {
  display: flex;
  min-height: 216px;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--graphite-200);
  border-radius: 14px;
  background: var(--surface);
}

.agent-card.entrypoint {
  border-top: 3px solid var(--orange-500);
}

.agent-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-card-id {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-card-id .mini-agent-icon {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.agent-card h3 {
  margin: 0;
  font-size: 0.87rem;
}

.agent-card .agent-code {
  display: block;
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.64rem;
  font-weight: 700;
}

.agent-description {
  margin: 14px 0;
  color: var(--graphite-500);
  font-size: 0.72rem;
  line-height: 1.55;
}

.agent-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: auto;
}

.meta-box {
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--graphite-100);
}

.meta-box span,
.meta-box strong {
  display: block;
}

.meta-box span {
  color: var(--graphite-500);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.meta-box strong {
  overflow: hidden;
  margin-top: 4px;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organization-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.organization-layout .wide {
  grid-column: 1 / -1;
}

.definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.definition-item {
  padding: 13px 14px;
  border: 1px solid var(--graphite-100);
  border-radius: 11px;
  background: #fafbfc;
}

.definition-item dt {
  color: var(--graphite-500);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.definition-item dd {
  margin: 6px 0 0;
  font-size: 0.75rem;
  font-weight: 750;
}

.rule-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-item {
  display: flex;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--graphite-100);
  border-radius: 10px;
}

.rule-number {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.66rem;
  font-weight: 900;
  place-items: center;
}

.rule-item p {
  margin: 3px 0 0;
  color: var(--graphite-600);
  font-size: 0.72rem;
  line-height: 1.5;
}

.execution-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.8fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
}

.form-panel {
  position: sticky;
  top: calc(var(--header-height) + 22px);
}

.form-group {
  margin-bottom: 17px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--graphite-700);
  font-size: 0.71rem;
  font-weight: 800;
}

.form-control {
  width: 100%;
  border: 1px solid var(--graphite-300);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--graphite-900);
  transition:
    border 150ms ease,
    box-shadow 150ms ease;
}

input.form-control {
  min-height: 44px;
  padding: 0 13px;
}

textarea.form-control {
  min-height: 160px;
  padding: 12px 13px;
  line-height: 1.55;
  resize: vertical;
}

.form-control:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 11%);
}

.form-control.invalid {
  border-color: #f87171;
}

.form-hint,
.character-counter {
  color: var(--graphite-500);
  font-size: 0.63rem;
}

.field-errors {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  color: var(--danger);
  font-size: 0.64rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.form-actions .primary-button {
  flex: 1;
}

.execution-progress {
  display: none;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.67rem;
  font-weight: 750;
}

.execution-progress.visible {
  display: flex;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid #fed7aa;
  border-top-color: var(--orange-600);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  display: grid;
  min-height: 390px;
  padding: 36px;
  text-align: center;
  place-items: center;
}

.empty-state-inner {
  max-width: 410px;
}

.empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: var(--orange-50);
  color: var(--orange-600);
  place-items: center;
}

.empty-icon svg {
  width: 29px;
  height: 29px;
}

.empty-state h3 {
  margin: 0;
  font-size: 1rem;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--graphite-500);
  font-size: 0.74rem;
  line-height: 1.6;
}

.execution-summary {
  padding: 18px 20px;
  border-bottom: 1px solid var(--graphite-100);
  background: linear-gradient(135deg, var(--orange-50), var(--surface));
}

.execution-summary span {
  color: var(--orange-700);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.execution-summary h3 {
  margin: 6px 0 0;
  font-size: 0.89rem;
  line-height: 1.45;
}

.timeline {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 20px;
}

.timeline::before {
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 35px;
  width: 2px;
  background: var(--graphite-200);
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
}

.timeline-index {
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--orange-500);
  color: var(--surface);
  font-size: 0.62rem;
  font-weight: 900;
  box-shadow: 0 0 0 1px var(--orange-200, #fed7aa);
  place-items: center;
}

.timeline-card {
  padding: 13px 14px;
  border: 1px solid var(--graphite-200);
  border-radius: 11px;
  background: #fafbfc;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-route {
  color: var(--graphite-900);
  font-size: 0.71rem;
  font-weight: 850;
}

.timeline-route span {
  color: var(--orange-600);
}

.timeline-type {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--graphite-100);
  color: var(--graphite-500);
  font-size: 0.57rem;
  font-weight: 850;
  text-transform: uppercase;
}

.timeline-card p {
  margin: 9px 0 0;
  color: var(--graphite-600);
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: rgb(15 23 42 / 48%);
  backdrop-filter: blur(2px);
}

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 0.85fr) minmax(480px, 1.15fr);
  background: var(--surface);
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.login-box {
  width: min(100%, 410px);
}

.login-logo {
  display: block;
  width: min(100%, 250px);
  max-height: 100px;
  margin-bottom: 34px;
  object-fit: contain;
  object-position: left center;
}

.login-box .eyebrow {
  margin-bottom: 9px;
}

.login-box h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.045em;
}

.login-intro {
  margin: 9px 0 28px;
  color: var(--graphite-500);
  font-size: 0.78rem;
  line-height: 1.6;
}

.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 30px;
  height: 30px;
  color: var(--graphite-500);
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 17px;
  height: 17px;
}

.login-submit {
  width: 100%;
  margin-top: 7px;
}

.login-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--graphite-100);
  color: var(--graphite-500);
  font-size: 0.65rem;
  line-height: 1.55;
}

.login-visual-side {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  padding: 70px;
  background:
    radial-gradient(circle at 73% 26%, rgb(249 115 22 / 30%), transparent 28%),
    radial-gradient(circle at 22% 82%, rgb(251 146 60 / 12%), transparent 25%),
    linear-gradient(145deg, #172033 0%, #0f172a 100%);
  color: var(--surface);
}

.login-visual-side::before {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image:
    linear-gradient(rgb(255 255 255 / 60%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 60%) 1px, transparent 1px);
  background-size: 40px 40px;
  content: "";
}

.login-visual-content {
  position: relative;
  z-index: 1;
  width: min(100%, 600px);
}

.login-visual-content h2 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1.07;
  letter-spacing: -0.055em;
}

.login-visual-content h2 span {
  color: var(--orange-400);
}

.login-visual-content > p {
  max-width: 510px;
  margin: 20px 0 0;
  color: var(--graphite-300);
  font-size: 0.9rem;
  line-height: 1.7;
}

.login-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 38px;
}

.login-feature {
  padding: 15px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 13px;
  background: rgb(255 255 255 / 5%);
  backdrop-filter: blur(8px);
}

.login-feature strong,
.login-feature small {
  display: block;
}

.login-feature strong {
  color: var(--orange-400);
  font-size: 1.2rem;
}

.login-feature small {
  margin-top: 5px;
  color: var(--graphite-400);
  font-size: 0.64rem;
  line-height: 1.4;
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .agents-layout,
  .execution-layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }

  .login-visual-side {
    padding: 46px;
  }

  .login-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .app-workspace {
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    padding: 0 20px;
  }

  .page-content {
    padding: 24px 20px 36px;
  }

  .user-copy,
  .environment-pill {
    display: none;
  }

  .user-area {
    padding-left: 0;
    border-left: 0;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-form-side {
    min-height: 100vh;
  }

  .login-visual-side {
    display: none;
  }
}

@media (max-width: 680px) {
  .metrics-grid,
  .agent-cards,
  .organization-layout,
  .definition-list {
    grid-template-columns: 1fr;
  }

  .organization-layout .wide {
    grid-column: auto;
  }

  .content-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .content-intro .primary-button,
  .content-intro .secondary-button {
    align-self: flex-start;
  }

  .topbar {
    min-height: 64px;
    padding: 0 14px;
  }

  .page-heading p,
  .logout-button {
    display: none;
  }

  .page-content {
    padding: 20px 14px 30px;
  }

  .panel-header,
  .panel-body {
    padding: 17px;
  }

  .org-node {
    width: 98px;
  }

  .org-node.child-one {
    left: 5%;
  }

  .org-node.independent {
    right: 5%;
  }

  .login-form-side {
    padding: 30px 22px;
  }
}

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

.department-card__coordinator {
  display: grid;
  gap: 4px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
}

.department-card__roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0;
}

.department-card__roles .department-card__coordinator {
  margin: 0;
}

.department-card__coordinator--finisher {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.department-card__coordinator--finisher small {
  color: #15803d;
}

.tag--green {
  background: #f0fdf4;
  color: #15803d;
}

.department-card__coordinator small {
  color: var(--orange-700);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.department-card__coordinator strong {
  color: var(--graphite-900);
  font-size: 0.76rem;
}

.department-card__chat {
  display: flex;
  justify-content: center;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  color: var(--graphite-700);
  font-size: 0.69rem;
  font-weight: 800;
}

.department-card__chat:hover {
  border-color: var(--orange-300);
  background: var(--orange-50);
  color: var(--orange-700);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(230px, 0.34fr) minmax(0, 1fr);
  gap: 18px;
  min-height: 640px;
}

.chat-list {
  align-self: start;
  padding: 12px;
}

.chat-list__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 14px;
  color: var(--graphite-900);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-list__heading small {
  color: var(--graphite-400);
  font-size: 0.58rem;
}

.chat-list__heading--conversations {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--graphite-100);
}

.chat-new-conversation {
  padding: 0 8px 10px;
}

.chat-new-conversation .button {
  width: 100%;
}

.chat-conversation-list {
  display: grid;
  gap: 5px;
  max-height: 330px;
  overflow-y: auto;
  padding: 0 4px 4px;
}

.chat-conversation-list {
  grid-template-columns: minmax(0, 1fr) auto;
}

.chat-conversation {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--graphite-700);
}

.chat-conversation:hover {
  border-color: var(--graphite-200);
  background: var(--graphite-50, #f8fafc);
}

.chat-conversation.is-active {
  border-color: #fdba74;
  background: #fff7ed;
}

.chat-conversation strong {
  overflow: hidden;
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation small {
  color: var(--graphite-400);
  font-size: .57rem;
}

.chat-conversation-actions {
  position: relative;
  align-self: center;
}

.chat-conversation-actions[open] {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0 7px 8px;
}

.chat-conversation-actions summary {
  padding: 7px;
  border-radius: 8px;
  color: var(--graphite-500);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.chat-conversation-actions summary::-webkit-details-marker {
  display: none;
}

.chat-conversation-actions[open] > div {
  position: static;
  display: grid;
  width: 100%;
  max-width: 100%;
  gap: 9px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 11px;
  background: #fff;
  box-shadow: none;
}

.chat-conversation-actions[open] summary {
  width: fit-content;
  margin-left: auto;
}

.chat-conversation-actions form:first-child {
  display: grid;
  gap: 7px;
}

.chat-conversation-actions input {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--graphite-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: .62rem;
  line-height: 1.35;
}

.chat-conversation-actions .button {
  width: 100%;
  font-size: .61rem;
}

.chat-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--graphite-700);
}

.chat-channel:hover {
  border-color: var(--graphite-200);
  background: var(--graphite-50, #f8fafc);
}

.chat-channel.is-active {
  border-color: #fed7aa;
  background: #fff7ed;
}

.chat-channel__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--graphite-100);
  color: var(--graphite-700);
  font-size: 0.65rem;
  font-weight: 900;
  place-items: center;
}

.chat-channel.is-active .chat-channel__icon {
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #fff;
}

.chat-channel__copy,
.chat-channel__copy strong,
.chat-channel__copy small {
  display: block;
  min-width: 0;
}

.chat-channel__copy {
  flex: 1;
}

.chat-channel__copy strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-channel__copy small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.61rem;
}

.chat-channel__arrow {
  color: var(--graphite-400);
  font-size: 1.2rem;
}

.chat-panel {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(360px, 1fr) auto;
}

.chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  border-bottom: 1px solid var(--graphite-100);
}

.chat-panel__header h3 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.chat-coordinator {
  display: grid;
  gap: 3px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--orange-50);
  text-align: right;
}

.chat-role-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.chat-panel__tools {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.chat-context-reset {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.chat-context-reset .button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.64rem;
}

.chat-context-reset small {
  color: var(--graphite-400);
  font-size: 0.57rem;
}

.chat-coordinator--finisher {
  background: #f0fdf4;
}

.chat-coordinator--finisher small {
  color: #15803d;
}

.chat-coordinator small {
  color: var(--orange-700);
  font-size: 0.55rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-coordinator strong {
  font-size: 0.67rem;
}

.chat-transcript {
  display: flex;
  max-height: 640px;
  min-height: 390px;
  overflow-y: auto;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background:
    linear-gradient(var(--graphite-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--graphite-100) 1px, transparent 1px),
    #fafbfc;
  background-size: 28px 28px;
}

.chat-message {
  align-self: flex-start;
  width: min(82%, 720px);
  padding: 13px 15px;
  border: 1px solid var(--graphite-200);
  border-radius: 4px 15px 15px;
  background: #fff;
  box-shadow: 0 6px 18px rgb(15 23 42 / 5%);
}

.chat-message--human {
  align-self: flex-end;
  border-color: #fdba74;
  border-radius: 15px 4px 15px 15px;
  background: #fff7ed;
}

.chat-message--final {
  border-color: #86efac;
  background: #f0fdf4;
}

.chat-message--failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.chat-message--context-reset {
  align-self: center;
  width: min(92%, 680px);
  border-style: dashed;
  border-color: var(--graphite-300);
  border-radius: 12px;
  background: rgb(255 255 255 / 88%);
  text-align: center;
}

.chat-message--context-reset .chat-message__meta {
  justify-content: center;
}

.chat-message__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--graphite-500);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-message__meta small {
  margin-left: auto;
  color: var(--orange-700);
}

.chat-message p {
  margin: 9px 0 0;
  color: var(--graphite-700);
  font-size: 0.76rem;
  line-height: 1.68;
  white-space: pre-wrap;
}

.chat-message__retry {
  margin-top: 12px;
}

body.agent-history-is-open {
  overflow: hidden;
}

.agent-history-modal {
  position: fixed;
  z-index: 10020;
  display: grid;
  inset: 0;
  place-items: center;
}

.agent-history-modal[hidden] {
  display: none;
}

.agent-history-modal__backdrop {
  position: absolute;
  border: 0;
  background: rgb(10 18 35 / 72%);
  backdrop-filter: blur(5px);
  cursor: pointer;
  inset: 0;
}

.agent-history-dialog {
  position: relative;
  display: grid;
  width: min(94vw, 980px);
  max-height: min(88vh, 820px);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--graphite-200);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 90px rgb(2 6 23 / 45%);
}

.agent-history-dialog > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--graphite-100);
}

.agent-history-dialog > header h3 { margin: 4px 0 0; }
.agent-history-dialog > header p { margin: 5px 0 0; color: var(--graphite-500); font-size: .68rem; }
.agent-history-dialog__close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--graphite-100); color: var(--graphite-700); font-size: 1.35rem; cursor: pointer; }
.agent-history-dialog__body { overflow-y: auto; padding: 18px 24px 26px; }
.agent-history-run { margin-bottom: 12px; border: 1px solid var(--graphite-200); border-radius: 12px; background: #fafbfc; }
.agent-history-run > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; cursor: pointer; font-size: .68rem; font-weight: 800; }
.agent-history-run > summary strong { padding: 4px 7px; border-radius: 999px; font-size: .52rem; }
.agent-history-run > summary strong.is-complete { background: #dcfce7; color: #166534; }
.agent-history-run > summary strong.is-failed { background: #fee2e2; color: #991b1b; }
.agent-history-run__objective { margin: 0; padding: 0 15px 13px; color: var(--graphite-600); font-size: .68rem; line-height: 1.55; }
.agent-history-run__messages { display: grid; gap: 8px; padding: 0 15px 15px; }
.agent-history-run__messages article { padding: 11px 12px; border: 1px solid var(--graphite-100); border-radius: 9px; background: #fff; }
.agent-history-run__messages article > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--graphite-500); font-size: .54rem; }
.agent-history-run__messages article > div small { margin-left: auto; padding: 3px 6px; border-radius: 999px; background: var(--graphite-100); }
.agent-history-run__messages article p { margin: 7px 0 0; color: var(--graphite-700); font-size: .63rem; line-height: 1.55; white-space: pre-wrap; }

@media (max-width: 680px) {
  .agent-history-dialog { width: 100%; max-height: 92dvh; align-self: end; border-radius: 20px 20px 0 0; }
  .agent-history-dialog > header, .agent-history-dialog__body { padding-right: 16px; padding-left: 16px; }
}

.chat-empty {
  display: grid;
  max-width: 430px;
  margin: auto;
  color: var(--graphite-500);
  text-align: center;
  place-items: center;
}

.chat-empty > span {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 17px;
  background: var(--orange-50);
  color: var(--orange-600);
  font-size: 1.3rem;
  place-items: center;
}

.chat-empty strong {
  color: var(--graphite-800);
  font-size: 0.86rem;
}

.chat-empty p {
  margin: 7px 0 0;
  font-size: 0.69rem;
  line-height: 1.55;
}

.chat-composer {
  padding: 16px 18px;
  border-top: 1px solid var(--graphite-100);
  background: #fff;
}

.chat-composer .form-field {
  margin: 0;
}

.chat-composer textarea {
  min-height: 92px;
  resize: vertical;
}

.chat-composer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 11px;
}

.chat-composer__footer > span {
  color: var(--graphite-500);
  font-size: 0.63rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-list {
    display: block;
  }

  .chat-list__heading {
    grid-column: 1 / -1;
  }

}

@media (max-width: 680px) {
  .chat-list {
    grid-template-columns: 1fr;
  }

  .chat-panel__header,
  .chat-composer__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-coordinator {
    text-align: left;
  }

  .chat-role-summary {
    justify-content: flex-start;
  }

  .chat-panel__tools {
    justify-items: stretch;
  }

  .chat-context-reset {
    justify-content: flex-start;
  }

  .chat-message {
    width: 94%;
  }

  .department-card__roles {
    grid-template-columns: 1fr;
  }
}

/* Componentes usados pelos templates Flask */
.brand-symbol {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.brand-symbol__node {
  position: absolute;
  z-index: 2;
  width: 10px;
  height: 10px;
  border: 2px solid #fed7aa;
  border-radius: 50%;
  background: var(--orange-500);
}

.brand-symbol__node--top {
  top: 1px;
  left: 14px;
}

.brand-symbol__node--left {
  bottom: 3px;
  left: 1px;
}

.brand-symbol__node--right {
  right: 1px;
  bottom: 3px;
}

.brand-symbol__line {
  position: absolute;
  z-index: 1;
  height: 2px;
  background: var(--orange-400);
  transform-origin: left center;
}

.brand-symbol__line--left {
  top: 12px;
  left: 17px;
  width: 25px;
  transform: rotate(126deg);
}

.brand-symbol__line--right {
  top: 11px;
  left: 21px;
  width: 24px;
  transform: rotate(54deg);
}

.brand-symbol__line--cross {
  bottom: 7px;
  left: 8px;
  width: 23px;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-size: 0.98rem;
  letter-spacing: 0.075em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--graphite-400);
  font-size: 0.59rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 9px;
  background: transparent;
  color: var(--graphite-300);
  cursor: pointer;
  font-size: 1.2rem;
}

.sidebar-context__label {
  display: block;
  margin-bottom: 5px;
  color: var(--graphite-400);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-context > strong {
  font-size: 0.78rem;
}

.sidebar-context .status-dot {
  display: flex;
  width: auto;
  height: auto;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #bbf7d0;
  font-size: 0.63rem;
}

.sidebar-context .status-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgb(34 197 94 / 12%);
}

.sidebar-menu {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
}

.sidebar-menu__title {
  padding: 10px 12px 4px;
  color: var(--graphite-500);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.sidebar-menu__title--secondary {
  margin-top: 10px;
}

.sidebar-link {
  position: relative;
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border-radius: 11px;
  color: var(--graphite-300);
  font-size: 0.79rem;
  font-weight: 700;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.sidebar-link:hover {
  background: rgb(255 255 255 / 6%);
  color: var(--surface);
  transform: translateX(2px);
}

.sidebar-link.is-active {
  background: linear-gradient(90deg, rgb(249 115 22 / 25%), rgb(249 115 22 / 7%));
  color: var(--surface);
}

.sidebar-link.is-active::before {
  position: absolute;
  inset: 8px auto 8px -14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--orange-500);
  content: "";
}

.sidebar-link__icon {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: var(--graphite-400);
  place-items: center;
}

.sidebar-link__icon svg,
.logout-button svg,
.button svg,
.metric-card__icon svg,
.input-shell__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sidebar-link.is-active .sidebar-link__icon {
  color: var(--orange-400);
}

.sidebar-link__badge,
.sidebar-link__soon {
  margin-left: auto;
  border-radius: 999px;
  font-size: 0.57rem;
  font-weight: 900;
}

.sidebar-link__badge {
  min-width: 20px;
  padding: 3px 6px;
  background: rgb(249 115 22 / 22%);
  color: var(--orange-400);
  text-align: center;
}

.sidebar-link__soon {
  padding: 3px 6px;
  background: rgb(255 255 255 / 7%);
  color: var(--graphite-500);
}

.sidebar-link.is-disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.sidebar-user {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.sidebar-user__avatar,
.topbar-user__avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  background: var(--orange-500);
  color: var(--surface);
  font-size: 0.7rem;
  font-weight: 900;
  place-items: center;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  font-size: 0.7rem;
}

.sidebar-user small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.59rem;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar__left,
.topbar__right,
.topbar-user,
.engine-status {
  display: flex;
  align-items: center;
}

.topbar__left {
  min-width: 0;
  gap: 14px;
}

.topbar__right {
  gap: 18px;
}

.topbar__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--orange-600);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 0.98rem;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.menu-toggle span {
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: var(--graphite-700);
}

.engine-status {
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.63rem;
  font-weight: 800;
}

.engine-status > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgb(34 197 94 / 11%);
}

.topbar-user {
  gap: 9px;
  padding-left: 16px;
  border-left: 1px solid var(--graphite-200);
}

.topbar-user__copy strong,
.topbar-user__copy small {
  display: block;
}

.topbar-user__copy strong {
  font-size: 0.7rem;
}

.topbar-user__copy small {
  margin-top: 2px;
  color: var(--graphite-500);
  font-size: 0.58rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading__eyebrow,
.panel-heading__eyebrow,
.login-card__eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--orange-600);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-heading h2 {
  margin: 0;
  font-size: clamp(1.38rem, 2vw, 1.9rem);
  letter-spacing: -0.035em;
}

.page-heading p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--graphite-500);
  font-size: 0.77rem;
  line-height: 1.6;
  white-space: normal;
}

.page-heading code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--graphite-200);
  color: var(--graphite-700);
  font-size: 0.7rem;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.button--primary {
  border: 1px solid var(--orange-500);
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: var(--surface);
  box-shadow: 0 8px 18px rgb(234 88 12 / 20%);
}

.button--primary:hover {
  box-shadow: 0 12px 22px rgb(234 88 12 / 26%);
  transform: translateY(-1px);
}

.button--primary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button--secondary {
  border: 1px solid var(--graphite-300);
  background: var(--surface);
  color: var(--graphite-700);
}

.button--secondary:hover {
  border-color: var(--orange-300);
  color: var(--orange-700);
}

.button--full {
  width: 100%;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 142px;
}

.metric-card__label,
.metric-card__detail,
.metric-card > strong {
  position: relative;
  z-index: 2;
  display: block;
}

.metric-card__label {
  color: var(--graphite-500);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metric-card > strong {
  margin-top: 11px;
  font-size: 1.72rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.metric-card .metric-card__status {
  color: var(--success);
  font-size: 1.32rem;
}

.metric-card__detail {
  margin-top: 5px;
  color: var(--graphite-500);
  font-size: 0.65rem;
}

.metric-card__icon {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  place-items: center;
}

.metric-card--orange {
  --metric-color: #ea580c;
  --metric-tint: #fff1e6;
}

.metric-card--amber {
  --metric-color: #d97706;
  --metric-tint: #fef3c7;
}

.metric-card--graphite {
  --metric-color: #475569;
  --metric-tint: #e2e8f0;
}

.metric-card--green {
  --metric-color: #16a34a;
  --metric-tint: #dcfce7;
}

.metric-card__icon {
  background: var(--metric-tint);
  color: var(--metric-color);
}

.dashboard-grid {
  margin-bottom: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 19px 21px;
  border-bottom: 1px solid var(--graphite-100);
}

.panel-heading h3 {
  margin: 0;
  font-size: 0.88rem;
}

.panel-heading a {
  color: var(--orange-600);
  font-size: 0.66rem;
  font-weight: 850;
}

.panel-heading__eyebrow {
  margin-bottom: 5px;
  font-size: 0.57rem;
}

.org-preview {
  position: relative;
  overflow-x: auto;
  min-height: 340px;
  padding: 32px;
  background:
    radial-gradient(circle at 50% 32%, rgb(249 115 22 / 9%), transparent 28%),
    linear-gradient(var(--graphite-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--graphite-100) 1px, transparent 1px);
  background-size:
    auto,
    25px 25px,
    25px 25px;
}

.org-preview__core,
.org-preview__member,
.external-agent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--graphite-200);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgb(15 23 42 / 7%);
}

.org-preview__core {
  width: max-content;
  margin: 0 auto;
  border-color: var(--orange-400);
}

.org-preview__core strong,
.org-preview__core small,
.org-preview__member strong,
.org-preview__member small,
.external-agent strong,
.external-agent small,
.external-agent > div > span {
  display: block;
}

.org-preview__core strong,
.org-preview__member strong,
.external-agent strong {
  font-size: 0.7rem;
}

.org-preview__core small,
.org-preview__member small,
.external-agent small,
.external-agent > div > span {
  margin-top: 2px;
  color: var(--graphite-500);
  font-size: 0.57rem;
}

.org-preview__connector {
  width: 2px;
  height: 38px;
  margin: 0 auto;
  background: var(--graphite-300);
}

.org-preview__team {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 28px;
}

.org-preview__team::before {
  position: absolute;
  top: -1px;
  left: 28%;
  right: 28%;
  height: 1px;
  background: var(--graphite-300);
  content: "";
}

.org-preview__member {
  position: relative;
  min-width: 145px;
  margin-top: 17px;
}

.org-preview__member::before {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--graphite-300);
  content: "";
}

.agent-orb {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: var(--graphite-100);
  color: var(--graphite-700);
  font-size: 0.58rem;
  font-weight: 900;
  place-items: center;
}

.agent-orb--lead {
  background: var(--orange-500);
  color: var(--surface);
}

.agent-orb--finisher {
  background: linear-gradient(135deg, #4ade80, #15803d);
  color: #fff;
}

.agent-orb--external {
  border: 1px dashed var(--graphite-400);
  background: var(--surface);
  color: var(--graphite-600);
}

.external-agent {
  width: max-content;
  max-width: 250px;
  margin: 34px 0 0 auto;
  border-style: dashed;
}

.external-agent__line {
  position: absolute;
  right: 250px;
  width: 66px;
  border-top: 1px dashed var(--graphite-400);
}

.org-chart {
  width: max-content;
  min-width: 100%;
}

.org-chart__tree,
.org-chart__tree ul {
  position: relative;
  display: flex;
  width: max-content;
  min-width: 100%;
  justify-content: center;
  margin: 0 auto;
  padding: 0;
  padding-top: 22px;
  list-style: none;
}

.org-chart__tree {
  padding-top: 0;
}

.org-chart__tree ul::before {
  position: absolute;
  top: 0;
  left: 50%;
  height: 22px;
  border-left: 1px solid var(--graphite-300);
  content: "";
}

.org-chart__tree li {
  position: relative;
  padding: 22px 7px 0;
  text-align: left;
}

.org-chart__tree > li {
  padding-top: 0;
}

.org-chart__tree li::before,
.org-chart__tree li::after {
  position: absolute;
  top: 0;
  width: 50%;
  height: 22px;
  border-top: 1px solid var(--graphite-300);
  content: "";
}

.org-chart__tree li::before {
  right: 50%;
}

.org-chart__tree li::after {
  left: 50%;
  border-left: 1px solid var(--graphite-300);
}

.org-chart__tree > li::before,
.org-chart__tree > li::after,
.org-chart__tree li:only-child::before,
.org-chart__tree li:only-child::after {
  display: none;
}

.org-chart__tree li:only-child {
  padding-top: 0;
}

.org-chart__tree li:first-child::before,
.org-chart__tree li:last-child::after {
  border: 0;
}

.org-chart__tree li:last-child::before {
  border-right: 1px solid var(--graphite-300);
  border-radius: 0 8px 0 0;
}

.org-chart__tree li:first-child::after {
  border-radius: 8px 0 0;
}

.org-chart__card {
  display: flex;
  width: max-content;
  min-width: 155px;
  max-width: 220px;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgb(15 23 42 / 7%);
}

.org-chart__card--lead {
  border-color: var(--orange-400);
  box-shadow: 0 10px 24px rgb(234 88 12 / 13%);
}

.org-chart__card--external {
  border-style: dashed;
  border-color: var(--graphite-400);
}

.org-chart__card > div {
  min-width: 0;
}

.org-chart__card strong,
.org-chart__card small {
  display: block;
}

.org-chart__card strong {
  color: var(--graphite-800);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.org-chart__card small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.55rem;
  line-height: 1.35;
}

.org-chart__independent {
  margin-top: 30px;
  padding-top: 17px;
  border-top: 1px dashed var(--graphite-300);
}

.org-chart__label {
  display: block;
  width: max-content;
  margin: 0 auto 13px;
  color: var(--graphite-500);
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.org-chart__tree--independent {
  min-width: 0;
}

.org-chart__legend {
  position: sticky;
  left: 0;
  display: flex;
  width: max-content;
  gap: 14px;
  margin-top: 26px;
  padding: 8px 10px;
  border: 1px solid var(--graphite-200);
  border-radius: 9px;
  background: rgb(255 255 255 / 90%);
}

.org-chart__legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--graphite-500);
  font-size: 0.54rem;
  font-weight: 750;
}

.org-chart__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--graphite-400);
}

.org-chart__dot--lead {
  background: var(--orange-500);
}

.org-chart__dot--external {
  border: 1px dashed var(--graphite-500);
  background: var(--surface);
}

.department-map {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
  gap: 14px;
}

.department-map__department {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--graphite-300);
  border-radius: 14px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 10px 24px rgb(15 23 42 / 7%);
}

.department-map__department::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--orange-500), var(--orange-400));
  content: "";
}

.department-map__header {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  padding: 15px 14px 13px;
  border-bottom: 1px solid var(--graphite-100);
  background: linear-gradient(135deg, var(--orange-50), var(--surface) 68%);
}

.department-map__icon {
  display: grid;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--orange-500);
  color: var(--surface);
  place-items: center;
}

.department-map__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.department-map__title,
.department-map__title small,
.department-map__title strong {
  display: block;
  min-width: 0;
}

.department-map__title small {
  color: var(--orange-600);
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.department-map__title strong {
  margin-top: 3px;
  color: var(--graphite-900);
  font-size: 0.67rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.department-map__count {
  display: grid;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--orange-700);
  font-size: 0.59rem;
  font-weight: 900;
  box-shadow: 0 4px 12px rgb(15 23 42 / 8%);
  place-items: center;
}

.department-map__agents {
  min-height: 74px;
  padding: 11px;
}

.department-map__tree {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.department-map__agents > .department-map__tree {
  width: min(100%, 460px);
  margin: 0 auto;
}

.department-map__tree .department-map__tree {
  margin: 7px 0 0 18px;
  padding-left: 18px;
  border-left: 1px solid var(--graphite-300);
}

.department-map__tree li {
  position: relative;
  margin-bottom: 7px;
}

.department-map__tree li:last-child {
  margin-bottom: 0;
}

.department-map__tree .department-map__tree > li::before {
  position: absolute;
  top: 21px;
  left: -18px;
  width: 14px;
  border-top: 1px solid var(--graphite-300);
  content: "";
}

.department-map__agent {
  display: grid;
  width: min(100%, 340px);
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.department-map__agent:hover {
  border-color: var(--orange-400);
  box-shadow: 0 8px 16px rgb(234 88 12 / 9%);
  transform: translateY(-1px);
}

.department-map__agent--lead {
  border-color: var(--orange-400);
}

.department-map__agent--finisher {
  border-color: #86efac;
  background: #f0fdf4;
}

.org-chart__dot--finisher {
  background: #22c55e;
}

.department-map__agent--independent {
  border-style: dashed;
  border-color: var(--graphite-400);
}

.department-map__agent .agent-orb {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 9px;
  font-size: 0.48rem;
}

.department-map__agent-copy,
.department-map__agent-copy strong,
.department-map__agent-copy small {
  display: block;
  min-width: 0;
}

.department-map__agent-copy strong {
  color: var(--graphite-800);
  font-size: 0.61rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.department-map__agent-copy small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.51rem;
  line-height: 1.35;
}

.department-map__agent-arrow {
  color: var(--graphite-400);
  font-size: 0.65rem;
}

.department-map__agent:hover .department-map__agent-arrow {
  color: var(--orange-600);
}

.department-map__empty {
  display: grid;
  min-height: 52px;
  padding: 10px;
  border: 1px dashed var(--graphite-300);
  border-radius: 9px;
  color: var(--graphite-500);
  font-size: 0.55rem;
  line-height: 1.4;
  text-align: center;
  place-items: center;
}

.department-map__footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--graphite-100);
  background: var(--canvas);
}

.department-map__footer span {
  padding: 8px 9px;
  color: var(--graphite-500);
  font-size: 0.48rem;
  text-align: center;
}

.department-map__footer span + span {
  border-left: 1px solid var(--graphite-200);
}

.department-map__footer strong {
  color: var(--graphite-800);
  font-size: 0.55rem;
}

.org-chart__box {
  width: 9px;
  height: 9px;
  border: 1px solid var(--orange-400);
  border-radius: 2px;
  background: var(--orange-50);
}

.standard-list {
  padding: 16px 19px 9px;
}

.standard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--graphite-100);
}

.standard-row span {
  color: var(--graphite-500);
  font-size: 0.64rem;
}

.standard-row strong {
  font-size: 0.67rem;
  text-align: right;
}

.panel > .panel-link {
  display: flex;
  justify-content: space-between;
  padding: 14px 19px 18px;
  color: var(--orange-600);
  font-size: 0.66rem;
  font-weight: 850;
}

.agent-code {
  color: var(--orange-700);
  font-size: 0.68rem;
  font-weight: 900;
}

.table-note {
  display: block;
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.58rem;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #15803d;
  font-size: 0.63rem;
  font-weight: 800;
}

.table-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.section-badge,
.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.61rem;
  font-weight: 850;
}

.section-badge {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--graphite-200);
  background: var(--surface);
  color: var(--graphite-600);
}

.section-badge--orange {
  border-color: var(--orange-100);
  background: var(--orange-50);
  color: var(--orange-700);
}

.section-badge--success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.agents-layout {
  align-items: start;
}

.page-heading__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.agents-layout__tree {
  min-width: 0;
  position: static;
  top: auto;
}

.tree-canvas {
  overflow-x: auto;
  padding: 20px;
}

.agent-tree,
.agent-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-tree ul {
  margin-top: 8px;
  margin-left: 19px;
  padding-left: 20px;
  border-left: 1px solid var(--graphite-300);
}

.agent-tree li {
  position: relative;
  margin-bottom: 9px;
}

.agent-tree ul > li::before {
  position: absolute;
  top: 23px;
  left: -20px;
  width: 16px;
  height: 1px;
  background: var(--graphite-300);
  content: "";
}

.agent-tree__card {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 11px;
  background: var(--surface);
}

.agent-tree__card strong,
.agent-tree__card small {
  display: block;
}

.agent-tree__card strong {
  font-size: 0.7rem;
}

.agent-tree__card small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.58rem;
}

.agent-card-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.agent-card-grid--catalog {
  width: 100%;
}

.agent-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.agent-card__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.agent-card__edit {
  display: grid;
  width: 29px;
  height: 29px;
  border: 1px solid var(--graphite-200);
  border-radius: 8px;
  background: var(--surface);
  color: var(--graphite-500);
  place-items: center;
}

.agent-card__edit:hover {
  border-color: var(--orange-200);
  background: var(--orange-50);
  color: var(--orange-700);
}

.agent-card__edit svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.tag {
  padding: 5px 8px;
}

.tag--orange {
  background: var(--orange-50);
  color: var(--orange-700);
}

.tag--dark {
  background: var(--graphite-900);
  color: var(--surface);
}

.tag--outline {
  border: 1px solid var(--graphite-200);
  background: var(--surface);
  color: var(--graphite-600);
}

.tag--department {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
}

.agent-card__title {
  margin-top: 14px;
}

.agent-card__title > span {
  color: var(--orange-600);
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.agent-card__title h3 {
  margin-top: 3px;
}

.agent-card > p {
  display: block !important;
  overflow: visible !important;
  min-height: 0;
  margin: 11px 0 14px;
  color: var(--graphite-500);
  font-size: 0.67rem;
  line-height: 1.55;
  -webkit-box-orient: initial !important;
  -webkit-line-clamp: unset !important;
  overflow-wrap: anywhere;
  white-space: normal;
}

.agent-card__meta {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: auto;
}

.agent-card__meta > span {
  display: block;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--graphite-100);
}

.agent-card__meta small,
.agent-card__meta strong {
  display: block;
}

.agent-card__meta small {
  color: var(--graphite-500);
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
}

.agent-card__meta strong {
  margin-top: 3px;
  font-size: 0.65rem;
}

.target-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.target-list span {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.56rem;
  font-weight: 800;
}

.department-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.department-metric {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  padding: 17px 19px;
  border: 1px solid var(--graphite-200);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.department-metric::after {
  position: absolute;
  right: -18px;
  bottom: -27px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--graphite-100);
  content: "";
}

.department-metric--orange {
  border-color: var(--orange-100);
  background: linear-gradient(135deg, var(--surface), var(--orange-50));
}

.department-metric--orange::after {
  background: rgb(249 115 22 / 12%);
}

.department-metric small,
.department-metric strong {
  position: relative;
  z-index: 1;
  display: block;
}

.department-metric small {
  color: var(--graphite-500);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.department-metric strong {
  margin-top: 8px;
  color: var(--graphite-900);
  font-size: 1.45rem;
}

.department-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.department-card {
  overflow: hidden;
}

.department-card__heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 31px;
  align-items: center;
  gap: 11px;
  padding: 18px 19px;
  border-bottom: 1px solid var(--graphite-100);
}

.department-card__icon {
  display: grid;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--orange-50);
  color: var(--orange-600);
  place-items: center;
}

.department-card__icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.department-card__key {
  display: block;
  color: var(--orange-600);
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.department-card__heading h3 {
  margin: 3px 0 0;
  font-size: 0.83rem;
}

.department-card__edit {
  display: grid;
  width: 31px;
  height: 31px;
  border: 1px solid var(--graphite-200);
  border-radius: 9px;
  color: var(--graphite-500);
  place-items: center;
}

.department-card__edit:hover {
  border-color: var(--orange-200);
  background: var(--orange-50);
  color: var(--orange-700);
}

.department-card__edit svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.department-card__description {
  min-height: 62px;
  margin: 0;
  padding: 15px 19px;
  color: var(--graphite-500);
  font-size: 0.66rem;
  line-height: 1.55;
}

.department-card__section {
  padding: 0 19px 18px;
}

.department-card__section--connections {
  padding-top: 17px;
  border-top: 1px solid var(--graphite-100);
  background: var(--canvas);
}

.department-card__section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--graphite-600);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.department-card__section-title strong {
  display: grid;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.58rem;
  place-items: center;
}

.department-agent-list {
  display: grid;
  gap: 7px;
}

.department-agent-list > a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
}

.department-agent-list > a:hover {
  border-color: var(--orange-200);
  background: var(--orange-50);
}

.department-agent-list .agent-orb {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 0.49rem;
}

.department-agent-list strong,
.department-agent-list small {
  display: block;
}

.department-agent-list strong {
  color: var(--graphite-800);
  font-size: 0.65rem;
}

.department-agent-list small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.55rem;
}

.department-card__add {
  display: inline-flex;
  margin-top: 11px;
  color: var(--orange-700);
  font-size: 0.59rem;
  font-weight: 850;
}

.department-card__add:hover {
  color: var(--orange-500);
}

.department-connections {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.department-connection {
  display: grid;
  min-width: 145px;
  flex: 1 1 145px;
  padding: 9px 10px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  background: var(--orange-50);
}

.department-connection--incoming {
  border-color: #dbeafe;
  background: #eff6ff;
}

.department-connection small,
.department-connection strong,
.department-connection i {
  display: block;
}

.department-connection small {
  color: var(--graphite-500);
  font-size: 0.51rem;
  font-weight: 850;
  text-transform: uppercase;
}

.department-connection strong {
  margin-top: 3px;
  color: var(--graphite-800);
  font-size: 0.59rem;
}

.department-connection i {
  margin-top: 4px;
  color: var(--graphite-500);
  font-size: 0.51rem;
  font-style: normal;
}

.department-empty {
  color: var(--graphite-500);
  font-size: 0.59rem;
  line-height: 1.45;
}

.department-form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: start;
  gap: 18px;
}

.department-form__body {
  padding: 19px 21px 21px;
}

.department-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 4px;
}

.department-form-help {
  padding: 21px;
  border-radius: 14px;
  background: var(--graphite-900);
  color: var(--surface);
  box-shadow: var(--shadow-lg);
}

.department-form-help > span {
  color: var(--orange-400);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.department-form-help h3 {
  margin: 8px 0 0;
  color: var(--surface);
  font-size: 0.93rem;
}

.department-form-help p,
.department-form-help li {
  color: var(--graphite-300);
  font-size: 0.64rem;
  line-height: 1.55;
}

.department-form-help p {
  margin: 12px 0 0;
}

.department-form-help ul {
  display: grid;
  gap: 7px;
  margin: 15px 0 0;
  padding-left: 17px;
}

.agent-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  align-items: start;
  gap: 18px;
}

.agent-editor__main,
.agent-editor__sidebar {
  min-width: 0;
}

.agent-editor__sidebar {
  display: grid;
  gap: 14px;
}

.agent-editor__panel {
  overflow: visible;
}

.agent-editor__body {
  padding: 19px 21px;
}

.agent-editor__body .form-field--last {
  margin-bottom: 0;
}

.agent-editor .form-field > input[readonly] {
  background: var(--graphite-100);
  color: var(--graphite-600);
  cursor: not-allowed;
}

.form-select {
  width: 100%;
  min-height: 44px;
  padding: 0 38px 0 13px;
  border: 1px solid var(--graphite-300);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--graphite-900);
}

.form-select:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 11%);
}

.role-options,
.relationship-options {
  display: grid;
  gap: 9px;
}

.role-option,
.relationship-option {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition:
    border 150ms ease,
    background 150ms ease;
}

.role-option:hover,
.relationship-option:hover {
  border-color: var(--orange-200);
  background: var(--orange-50);
}

.role-option input,
.relationship-option input {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  margin-top: 2px;
  accent-color: var(--orange-600);
}

.role-option span,
.relationship-option span {
  min-width: 0;
}

.role-option strong,
.role-option small {
  display: block;
}

.role-option strong {
  color: var(--graphite-800);
  font-size: 0.67rem;
}

.role-option small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.57rem;
  line-height: 1.45;
}

.relationship-option span {
  color: var(--graphite-700);
  font-size: 0.63rem;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.relationship-note {
  margin: 0 0 11px;
  color: var(--graphite-500);
  font-size: 0.61rem;
  line-height: 1.5;
}

.agent-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 4px 0 20px;
}

.standard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.standard-card {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--graphite-200);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.standard-card span,
.standard-card strong {
  display: block;
}

.standard-card span {
  color: var(--graphite-500);
  font-size: 0.59rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.standard-card strong {
  margin-top: 12px;
  font-size: 0.76rem;
  line-height: 1.4;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-count {
  width: 29px;
  height: 29px;
  background: var(--orange-50);
  color: var(--orange-700);
}

.rule-list {
  padding: 18px 20px 20px;
}

.rule-list li {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--graphite-100);
}

.rule-list li:last-child {
  border-bottom: 0;
}

.rule-list li > span {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border-radius: 8px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.59rem;
  font-weight: 900;
  place-items: center;
}

.rule-list li p {
  margin: 3px 0 0;
  color: var(--graphite-600);
  font-size: 0.68rem;
  line-height: 1.5;
}

.runtime-info {
  display: flex;
  gap: 9px;
}

.runtime-info > span {
  min-width: 95px;
  padding: 9px 11px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
}

.runtime-info small,
.runtime-info strong {
  display: block;
}

.runtime-info small {
  color: var(--graphite-500);
  font-size: 0.54rem;
  font-weight: 850;
  text-transform: uppercase;
}

.runtime-info strong {
  margin-top: 4px;
  font-size: 0.64rem;
}

.execution-form-panel {
  padding-bottom: 19px;
}

.execution-form {
  padding: 19px 21px 0;
}

.form-field {
  margin-bottom: 16px;
}

.form-field > label {
  display: block;
  margin-bottom: 7px;
  color: var(--graphite-700);
  font-size: 0.68rem;
  font-weight: 850;
}

.form-field > input,
.form-field > textarea,
.input-shell > input {
  width: 100%;
  border: 1px solid var(--graphite-300);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--graphite-900);
  transition:
    border 150ms ease,
    box-shadow 150ms ease;
}

.form-field > input,
.input-shell > input {
  min-height: 44px;
  padding: 0 13px;
}

.form-field > textarea {
  min-height: 170px;
  padding: 12px 13px;
  line-height: 1.55;
  resize: vertical;
}

.form-field > input:focus,
.form-field > textarea:focus,
.input-shell > input:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 11%);
}

.field-helper {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--graphite-500);
  font-size: 0.58rem;
}

.field-error {
  display: block;
  margin-top: 5px;
  color: var(--danger);
  font-size: 0.59rem;
}

.execution-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.execution-actions > span {
  color: var(--graphite-500);
  font-size: 0.57rem;
  line-height: 1.45;
}

.execution-progress {
  margin: 15px 20px 0;
}

.execution-progress__spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid #fed7aa;
  border-top-color: var(--orange-600);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.execution-progress strong,
.execution-progress small {
  display: block;
}

.execution-progress strong {
  font-size: 0.66rem;
}

.execution-progress small {
  margin-top: 3px;
  font-size: 0.57rem;
  line-height: 1.4;
}

.execution-guide {
  align-self: stretch;
}

.execution-guide > ol {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 20px;
  list-style: none;
}

.execution-guide li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.execution-guide li > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.62rem;
  font-weight: 900;
  place-items: center;
}

.execution-guide p {
  margin: 0;
  color: var(--graphite-600);
  font-size: 0.67rem;
  line-height: 1.45;
}

.execution-result {
  margin-top: 18px;
}

.execution-result__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.execution-result__heading h2 {
  margin: 0;
  font-size: 1.18rem;
}

.message-timeline {
  position: relative;
  display: grid;
  gap: 11px;
}

.message-timeline::before {
  position: absolute;
  top: 19px;
  bottom: 19px;
  left: 20px;
  width: 2px;
  background: var(--graphite-200);
  content: "";
}

.message-card {
  position: relative;
  display: grid;
  grid-template-columns: 41px minmax(0, 1fr);
  gap: 10px;
}

.message-card__rail {
  z-index: 1;
  padding-top: 13px;
}

.message-card__rail span {
  display: grid;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border: 3px solid var(--canvas);
  border-radius: 50%;
  background: var(--orange-500);
  color: var(--surface);
  font-size: 0.58rem;
  font-weight: 900;
  place-items: center;
}

.message-card__body {
  padding: 14px 15px;
  border: 1px solid var(--graphite-200);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgb(15 23 42 / 4%);
}

.message-card--final .message-card__body {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.message-card--objective .message-card__body {
  border-color: var(--orange-100);
  background: var(--orange-50);
}

.message-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.message-arrow {
  color: var(--graphite-400);
}

.message-card__body > p {
  margin: 9px 0 0;
  color: var(--graphite-600);
  font-size: 0.68rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.flash-message--success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.flash-message--error,
.flash-message--danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.flash-message--warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.flash-message button[data-dismiss-flash] {
  width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  cursor: pointer;
}

.login-shell {
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  grid-template-columns: minmax(460px, 1.12fr) minmax(380px, 0.88fr);
}

body.login-page {
  display: block;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--surface);
}

.login-identity {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 7vw, 100px);
  background:
    radial-gradient(circle at 70% 25%, rgb(249 115 22 / 30%), transparent 28%),
    linear-gradient(145deg, #172033 0%, #0f172a 100%);
  color: var(--surface);
  min-height: 0;
}

.login-identity::before {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image:
    linear-gradient(rgb(255 255 255 / 65%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 65%) 1px, transparent 1px);
  background-size: 40px 40px;
  content: "";
}

.login-identity__glow {
  position: absolute;
  top: 20%;
  right: 12%;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgb(249 115 22 / 16%);
  filter: blur(20px);
}

.login-logo,
.login-identity__copy,
.login-network {
  position: relative;
  z-index: 2;
}

.login-logo {
  width: min(100%, 285px);
  height: auto;
  max-height: none;
  margin-bottom: 55px;
  object-position: left center;
}

.login-identity__copy {
  max-width: 590px;
}

.login-identity__copy > span {
  color: var(--orange-400);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-identity__copy h1 {
  margin: 13px 0 0;
  font-size: clamp(2.3rem, 4.5vw, 4.6rem);
  line-height: 1.03;
  letter-spacing: -0.06em;
}

.login-identity__copy p {
  max-width: 520px;
  margin: 21px 0 0;
  color: var(--graphite-300);
  font-size: 0.84rem;
  line-height: 1.7;
}

.login-network {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-top: 45px;
}

.login-network i {
  position: relative;
  width: 12px;
  height: 12px;
  border: 2px solid #fed7aa;
  border-radius: 50%;
  background: var(--orange-500);
}

.login-network i:not(:last-child)::after {
  position: absolute;
  top: 3px;
  left: 12px;
  width: 34px;
  height: 2px;
  background: rgb(251 146 60 / 50%);
  content: "";
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
  min-height: 0;
  overflow-y: auto;
}

.login-card {
  width: min(100%, 390px);
}

.login-card__heading h2 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.login-card__heading p {
  margin: 8px 0 26px;
  color: var(--graphite-500);
  font-size: 0.74rem;
}

.login-form {
  margin-top: 18px;
}

.input-shell {
  position: relative;
}

.input-shell__icon {
  position: absolute;
  top: 50%;
  left: 13px;
  display: grid;
  width: 18px;
  height: 18px;
  color: var(--graphite-400);
  transform: translateY(-50%);
  place-items: center;
}

.input-shell > input {
  padding-right: 43px;
  padding-left: 42px;
}

.input-shell .password-toggle {
  right: 8px;
}

.login-card__footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--graphite-100);
  color: var(--graphite-500);
  font-size: 0.58rem;
}

.login-card__footer span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-card__footer i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

@media (max-width: 1180px) {
  .metric-grid,
  .standard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-card-grid {
    grid-template-columns: 1fr;
  }

  .agent-editor {
    grid-template-columns: 1fr;
  }

  .department-grid,
  .department-form-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .menu-toggle,
  .sidebar-close {
    display: flex;
  }

  .engine-status,
  .topbar-user__copy {
    display: none;
  }

  .agents-layout__tree {
    position: static;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-identity {
    display: none;
  }

  .login-panel {
    min-height: 100dvh;
    padding: 30px 22px;
  }
}

@media (max-width: 680px) {
  .metric-grid,
  .standard-grid,
  .rules-grid,
  .agent-card-grid,
  .department-metrics,
  .department-grid {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .execution-result__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading__actions {
    justify-content: flex-start;
  }

  .runtime-info {
    align-self: flex-start;
  }

  .org-preview {
    padding: 25px 15px;
  }

  .org-preview__team {
    gap: 8px;
  }

  .org-preview__member {
    min-width: 0;
    padding: 9px;
  }

  .external-agent {
    margin-right: auto;
  }

  .external-agent__line {
    display: none;
  }

  .execution-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Bloqueio visual enquanto o chat aguarda a execução síncrona do LangGraph */
body.agent-is-loading {
  overflow: hidden;
}

.chat-loading-overlay {
  position: fixed;
  z-index: 9999;
  display: grid;
  padding: 24px;
  background: rgb(10 18 35 / 76%);
  opacity: 0;
  backdrop-filter: blur(7px);
  inset: 0;
  place-items: center;
  transition: opacity 180ms ease;
}

.chat-loading-overlay[hidden] {
  display: none;
}

.chat-loading-overlay.is-visible {
  opacity: 1;
}

.chat-loading-card {
  width: min(100%, 510px);
  overflow: hidden;
  padding: 30px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0, rgb(249 115 22 / 13%), transparent 35%),
    #fff;
  box-shadow: 0 30px 90px rgb(2 6 23 / 45%);
  opacity: 0;
  text-align: center;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 180ms ease,
    transform 220ms ease;
}

.chat-loading-overlay.is-visible .chat-loading-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-loading-network {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
}

.chat-loading-network::before,
.chat-loading-network::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  inset: 0;
}

.chat-loading-network::before {
  border: 2px solid #ffedd5;
  border-top-color: var(--orange-500);
  animation: cognarquia-loading-spin 1.15s linear infinite;
}

.chat-loading-network::after {
  inset: 9px;
  border: 1px dashed #fdba74;
  animation: cognarquia-loading-spin 4s linear infinite reverse;
}

.chat-loading-network__core,
.chat-loading-network__node {
  position: absolute;
  z-index: 3;
  display: block;
  border: 2px solid #fff;
  border-radius: 50%;
  background: linear-gradient(135deg, #fb923c, #ea580c);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 12%);
}

.chat-loading-network__core {
  top: 35px;
  left: 35px;
  width: 22px;
  height: 22px;
  animation: cognarquia-loading-pulse 1.5s ease-in-out infinite;
}

.chat-loading-network__node {
  width: 13px;
  height: 13px;
}

.chat-loading-network__node--one {
  top: 12px;
  left: 40px;
}

.chat-loading-network__node--two {
  right: 14px;
  bottom: 17px;
}

.chat-loading-network__node--three {
  bottom: 17px;
  left: 14px;
}

.chat-loading-network__line {
  position: absolute;
  z-index: 2;
  display: block;
  width: 29px;
  height: 2px;
  background: #fb923c;
  transform-origin: left center;
}

.chat-loading-network__line--one {
  top: 42px;
  left: 45px;
  transform: rotate(-90deg);
}

.chat-loading-network__line--two {
  top: 49px;
  left: 50px;
  transform: rotate(39deg);
}

.chat-loading-network__line--three {
  top: 49px;
  left: 42px;
  transform: rotate(141deg);
}

.chat-loading-card__eyebrow {
  color: var(--orange-600);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chat-loading-card h3 {
  margin: 8px 0 0;
  color: var(--graphite-900);
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.chat-loading-card > p {
  min-height: 42px;
  margin: 9px auto 0;
  color: var(--graphite-500);
  font-size: 0.74rem;
  line-height: 1.55;
}

.chat-loading-progress {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 19px 0;
}

.chat-loading-progress i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange-400);
  animation: cognarquia-loading-dot 1.3s ease-in-out infinite;
}

.chat-loading-progress i:nth-child(2) {
  animation-delay: 130ms;
}

.chat-loading-progress i:nth-child(3) {
  animation-delay: 260ms;
}

.chat-loading-progress i:nth-child(4) {
  animation-delay: 390ms;
}

.chat-loading-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-loading-steps li {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 10px 5px;
  border: 1px solid var(--graphite-100);
  border-radius: 10px;
  background: #fafbfc;
  color: var(--graphite-400);
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 1.3;
  place-items: center;
}

.chat-loading-steps li > i {
  width: 9px;
  height: 9px;
  border: 2px solid var(--graphite-300);
  border-radius: 50%;
  background: #fff;
}

.chat-loading-steps li.is-active {
  border-color: #fdba74;
  background: #fff7ed;
  color: var(--orange-700);
}

.chat-loading-steps li.is-active > i {
  border-color: var(--orange-500);
  background: var(--orange-500);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 14%);
  animation: cognarquia-loading-pulse 1.2s ease-in-out infinite;
}

.chat-loading-steps li.is-complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.chat-loading-steps li.is-complete > i {
  border-color: #22c55e;
  background: #22c55e;
}

.chat-loading-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--graphite-100);
  text-align: left;
}

.chat-loading-card__footer span {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--graphite-500);
  font-size: 0.59rem;
  font-weight: 700;
}

.chat-loading-card__footer strong {
  color: var(--graphite-900);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.chat-loading-card__footer small {
  color: #b45309;
  font-size: 0.59rem;
  font-weight: 800;
}

@keyframes cognarquia-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cognarquia-loading-pulse {
  50% {
    box-shadow: 0 0 0 8px rgb(249 115 22 / 7%);
    transform: scale(1.06);
  }
}

@keyframes cognarquia-loading-dot {
  0%,
  60%,
  100% {
    opacity: 0.32;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

@media (max-width: 560px) {
  .chat-loading-overlay {
    align-items: end;
    padding: 12px;
  }

  .chat-loading-card {
    padding: 24px 17px 20px;
    border-radius: 22px;
  }

  .chat-loading-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-loading-card__footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-loading-network::before,
  .chat-loading-network::after,
  .chat-loading-network__core,
  .chat-loading-progress i,
  .chat-loading-steps li.is-active > i {
    animation: none;
  }
}

/* Fontes de dados e catálogo de metadados */
.source-metrics,
.source-catalog-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.source-metric,
.source-catalog-metrics > span {
  padding: 16px 18px;
  border: 1px solid var(--graphite-200);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgb(15 23 42 / 5%);
}

.source-metric small,
.source-metric strong,
.source-catalog-metrics small,
.source-catalog-metrics strong {
  display: block;
}

.source-metric small,
.source-catalog-metrics small {
  color: var(--graphite-500);
  font-size: 0.59rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.source-metric strong,
.source-catalog-metrics strong {
  margin-top: 8px;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}

.source-metric--green strong {
  color: var(--success);
}

.source-metric--orange strong {
  color: var(--orange-600);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

.source-card {
  overflow: hidden;
}

.source-card__heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 19px 20px 16px;
  border-bottom: 1px solid var(--graphite-100);
}

.source-card__engine {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: var(--orange-50);
  color: var(--orange-600);
  place-items: center;
}

.source-card__engine svg,
.source-empty__icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.source-card__heading > span:nth-child(2) {
  min-width: 0;
}

.source-card__heading small,
.source-card__heading h3 {
  display: block;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-card__heading small {
  color: var(--orange-600);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-card__heading h3 {
  margin-top: 4px;
  font-size: 0.86rem;
}

.source-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 0.57rem;
  font-weight: 850;
  white-space: nowrap;
}

.source-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.source-status--connected {
  background: #f0fdf4;
  color: #15803d;
}

.source-status--connected i {
  background: #22c55e;
}

.source-status--error {
  background: #fef2f2;
  color: #b91c1c;
}

.source-status--error i {
  background: #ef4444;
}

.source-status--pending {
  background: var(--graphite-100);
  color: var(--graphite-600);
}

.source-status--pending i {
  background: var(--graphite-400);
}

.source-card__address {
  padding: 17px 20px;
}

.source-card__address span,
.source-card__address strong,
.source-card__address small {
  display: block;
}

.source-card__address span {
  color: var(--graphite-500);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.source-card__address strong {
  margin-top: 6px;
  color: var(--graphite-800);
  font-size: 0.71rem;
  overflow-wrap: anywhere;
}

.source-card__address small {
  margin-top: 5px;
  color: var(--graphite-500);
  font-size: 0.59rem;
}

.source-card__numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 20px;
  border: 1px solid var(--graphite-200);
  border-radius: 11px;
}

.source-card__numbers span {
  padding: 11px 12px;
  border-right: 1px solid var(--graphite-200);
}

.source-card__numbers span:last-child {
  border-right: 0;
}

.source-card__numbers small,
.source-card__numbers strong {
  display: block;
}

.source-card__numbers small {
  color: var(--graphite-500);
  font-size: 0.53rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-card__numbers strong {
  margin-top: 4px;
  font-size: 0.82rem;
}

.source-card__security {
  margin: 13px 20px 0;
  padding: 10px 12px;
  border-radius: 10px;
}

.source-card__security strong,
.source-card__security span {
  display: block;
}

.source-card__security strong {
  font-size: 0.61rem;
}

.source-card__security span {
  margin-top: 3px;
  font-size: 0.56rem;
}

.source-card__security.is-ready {
  background: #f0fdf4;
  color: #166534;
}

.source-card__security.has-warning {
  background: #fffbeb;
  color: #92400e;
}

.source-card__open {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
  margin: 16px 20px 20px;
  padding: 14px 15px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  color: #9a3412;
  box-shadow: 0 8px 20px rgb(234 88 12 / 8%);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.source-card__open:hover {
  border-color: var(--orange-500);
  box-shadow: 0 12px 28px rgb(234 88 12 / 16%);
  transform: translateY(-2px);
}

.source-card__open-icon {
  display: grid;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--orange-600);
  color: #fff;
  place-items: center;
}

.source-card__open-icon svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.source-card__open-copy strong,
.source-card__open-copy small {
  display: block;
}

.source-card__open-copy strong {
  font-size: .72rem;
  font-weight: 900;
}

.source-card__open-copy small {
  margin-top: 3px;
  color: #9a5b3e;
  font-size: .56rem;
}

.source-card__open-arrow {
  font-size: 1.15rem;
  text-align: center;
}

.source-empty {
  display: flex;
  min-height: 330px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.source-empty__icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: var(--orange-50);
  color: var(--orange-600);
  place-items: center;
}

.source-empty h3 {
  margin: 0;
  font-size: 1rem;
}

.source-empty p {
  max-width: 520px;
  margin: 9px auto 19px;
  color: var(--graphite-500);
  font-size: 0.69rem;
  line-height: 1.6;
}

.source-form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.source-form__body {
  padding: 20px 22px 22px;
}

.source-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.source-form__grid--host {
  grid-template-columns: minmax(0, 1fr) 150px;
}

.source-form input[readonly] {
  background: var(--graphite-100);
  color: var(--graphite-600);
  cursor: not-allowed;
}

.source-password input {
  padding-right: 43px;
}

.source-engine-pill {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.source-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}

.source-form-help {
  padding: 22px;
  border: 1px solid #fed7aa;
  border-radius: 16px;
  background:
    radial-gradient(circle at 90% 5%, rgb(249 115 22 / 14%), transparent 35%),
    #fffaf5;
  box-shadow: var(--shadow);
}

.source-form-help > span {
  color: var(--orange-700);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.source-form-help h3 {
  margin: 8px 0 0;
  font-size: 1rem;
}

.source-form-help > p {
  margin: 9px 0 18px;
  color: var(--graphite-600);
  font-size: 0.66rem;
  line-height: 1.6;
}

.source-form-help ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-form-help li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid rgb(249 115 22 / 14%);
  border-radius: 9px;
  background: rgb(255 255 255 / 65%);
  color: var(--graphite-700);
  font-size: 0.61rem;
}

.source-form-help li strong {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  border-radius: 7px;
  background: var(--orange-100);
  color: var(--orange-700);
  font-size: 0.57rem;
  place-items: center;
}

.source-form-help__warning {
  margin-top: 16px;
  padding: 11px 12px;
  border-radius: 9px;
  background: #ffedd5;
  color: #9a3412;
  font-size: 0.59rem;
  font-weight: 750;
  line-height: 1.5;
}

.source-health {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 17px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 13px;
}

.source-health--ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.source-health--warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.source-health__icon {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 900;
  place-items: center;
}

.source-health > div {
  min-width: 0;
}

.source-health strong {
  display: block;
  font-size: 0.68rem;
}

.source-health p {
  margin: 4px 0 0;
  font-size: 0.59rem;
  line-height: 1.45;
}

.source-health form {
  margin-left: auto;
}

.source-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(275px, 0.55fr);
  gap: 17px;
  margin-bottom: 25px;
  align-items: start;
}

.source-schema-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 18px 20px 13px;
}

.source-schema-option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border 140ms ease, background 140ms ease;
}

.source-schema-option:hover {
  border-color: var(--orange-200);
  background: var(--orange-50);
}

.source-schema-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  accent-color: var(--orange-600);
}

.source-schema-option span {
  min-width: 0;
}

.source-schema-option strong,
.source-schema-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-schema-option strong {
  color: var(--graphite-800);
  font-size: 0.66rem;
}

.source-schema-option small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.55rem;
  white-space: nowrap;
}

.source-schema-option > i {
  margin-left: auto;
  color: var(--success);
  font-size: 0.52rem;
  font-style: normal;
  font-weight: 850;
}

.source-schema-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px 18px;
  border-top: 1px solid var(--graphite-100);
}

.source-schema-form__footer p {
  max-width: 560px;
  margin: 0;
  color: var(--graphite-500);
  font-size: 0.58rem;
  line-height: 1.5;
}

.source-schema-form__footer p small {
  display: block;
  margin-top: 5px;
  color: var(--danger);
  font-size: 0.58rem;
  font-weight: 800;
}

.source-schema-form__footer [data-source-schema-error][hidden] {
  display: none;
}

.source-schema-empty {
  margin: 0;
  padding: 16px 20px;
  color: var(--graphite-500);
  font-size: 0.63rem;
  line-height: 1.55;
}

.source-definition-list {
  margin: 0;
  padding: 10px 20px 17px;
}

.source-definition-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--graphite-100);
}

.source-definition-list > div:last-child {
  border-bottom: 0;
}

.source-definition-list dt {
  color: var(--graphite-500);
  font-size: 0.57rem;
  font-weight: 800;
}

.source-definition-list dd {
  margin: 0;
  color: var(--graphite-800);
  font-size: 0.6rem;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.source-catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
}

.source-catalog-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.source-search {
  position: relative;
  width: min(100%, 330px);
}

.source-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  fill: none;
  stroke: var(--graphite-400);
  stroke-width: 1.8;
  transform: translateY(-50%);
}

.source-search input {
  width: 100%;
  min-height: 40px;
  padding: 0 13px 0 38px;
  border: 1px solid var(--graphite-300);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  font-size: 0.64rem;
}

.source-search input:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 10%);
}

.source-filter-bar,
.source-relationship-filter {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 13px;
}

.source-filter-bar {
  padding: 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 12px;
  background: var(--graphite-50);
}

.source-filter-select span {
  display: block;
  margin: 0 0 5px 2px;
  color: var(--graphite-500);
  font-size: 0.5rem;
  font-weight: 850;
  text-transform: uppercase;
}

.source-filter-select select {
  min-width: 135px;
  min-height: 40px;
  padding: 0 32px 0 11px;
  border: 1px solid var(--graphite-300);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--graphite-700);
  font-size: 0.6rem;
}

.source-filter-select--size select {
  min-width: 92px;
}

.source-filter-select select:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgb(249 115 22 / 10%);
}

.source-filter-result {
  margin-left: auto;
  padding: 0 3px 10px;
  color: var(--graphite-500);
  font-size: 0.55rem;
  white-space: nowrap;
}

.source-filter-result strong {
  color: var(--orange-700);
}

.source-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.source-pagination--panel {
  padding: 0 20px 17px;
  margin-top: 0;
}

.source-pagination button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--graphite-300);
  border-radius: 9px;
  background: var(--surface);
  color: var(--graphite-700);
  cursor: pointer;
  font-size: 0.56rem;
  font-weight: 800;
}

.source-pagination button:hover:not(:disabled) {
  border-color: var(--orange-400);
  color: var(--orange-700);
}

.source-pagination button:disabled {
  cursor: default;
  opacity: 0.4;
}

.source-pagination span {
  min-width: 100px;
  color: var(--graphite-500);
  font-size: 0.56rem;
  text-align: center;
}

.source-catalog-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.source-catalog {
  display: grid;
  gap: 14px;
}

.source-catalog-schema {
  overflow: hidden;
}

.source-catalog-schema__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--graphite-100);
  background: linear-gradient(90deg, var(--orange-50), var(--surface) 35%);
}

.source-catalog-schema__heading small,
.source-catalog-schema__heading strong {
  display: block;
}

.source-catalog-schema__heading small {
  color: var(--orange-700);
  font-size: 0.51rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-catalog-schema__heading strong {
  margin-top: 3px;
  font-size: 0.75rem;
}

.source-catalog-schema__heading > i {
  color: var(--graphite-500);
  font-size: 0.57rem;
  font-style: normal;
}

.source-table-list {
  padding: 4px 18px 13px;
}

.source-table {
  border-bottom: 1px solid var(--graphite-100);
}

.source-table:last-child {
  border-bottom: 0;
}

.source-table > summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 13px 1px;
  cursor: pointer;
  list-style: none;
}

.source-table > summary::-webkit-details-marker {
  display: none;
}

.source-table__icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--graphite-100);
  color: var(--graphite-600);
  font-size: 0.57rem;
  font-weight: 900;
  place-items: center;
}

.source-table[open] .source-table__icon {
  background: var(--orange-50);
  color: var(--orange-700);
}

.source-table__identity {
  min-width: 0;
}

.source-table__identity strong,
.source-table__identity small,
.source-table__volume small,
.source-table__volume strong {
  display: block;
}

.source-table__identity strong {
  overflow: hidden;
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-table__identity small,
.source-table__volume small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.54rem;
}

.source-table__volume {
  margin-left: auto;
  text-align: right;
}

.source-table__volume strong {
  margin-top: 3px;
  color: var(--graphite-700);
  font-size: 0.58rem;
}

.source-table__chevron {
  margin-left: 8px;
  color: var(--graphite-400);
  font-size: 1rem;
  font-style: normal;
  transition: transform 150ms ease;
}

.source-table[open] .source-table__chevron {
  transform: rotate(180deg);
}

.source-table__content {
  padding: 0 0 15px 41px;
}

.source-table__comment {
  margin: 0 0 10px;
  color: var(--graphite-600);
  font-size: 0.6rem;
  line-height: 1.5;
}

.source-column-table {
  overflow: hidden;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
}

.source-column-table__head,
.source-column-table__row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.8fr) minmax(95px, 0.65fr) minmax(140px, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
}

.source-column-table__head {
  background: var(--graphite-100);
  color: var(--graphite-500);
  font-size: 0.51rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.source-column-table__row {
  border-top: 1px solid var(--graphite-100);
  font-size: 0.57rem;
}

.source-column-table__row strong {
  overflow-wrap: anywhere;
}

.source-column-table__row code {
  color: var(--orange-700);
  font-size: 0.55rem;
  overflow-wrap: anywhere;
}

.source-column-table__row span,
.source-column-table__row small {
  color: var(--graphite-500);
  font-size: 0.54rem;
  overflow-wrap: anywhere;
}

.source-column-table__row span i {
  margin-right: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--orange-100);
  color: var(--orange-700);
  font-size: 0.48rem;
  font-style: normal;
  font-weight: 900;
}

.source-index-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.source-index-list > strong {
  align-self: center;
  color: var(--graphite-500);
  font-size: 0.54rem;
  text-transform: uppercase;
}

.source-index-list > span {
  display: inline-flex;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--graphite-100);
  color: var(--graphite-500);
  font-size: 0.51rem;
}

.source-index-list code {
  color: var(--graphite-700);
}

.source-search-empty {
  padding: 30px;
  border: 1px dashed var(--graphite-300);
  border-radius: 12px;
  color: var(--graphite-500);
  font-size: 0.65rem;
  text-align: center;
}

.source-relationship-panel {
  margin-top: 17px;
  overflow: hidden;
}

.source-relationship-list {
  display: grid;
  gap: 8px;
  padding: 15px 20px 19px;
}

.source-relationship-filter {
  padding: 14px 20px 0;
  margin-bottom: 0;
}

.source-relationship {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
}

.source-relationship[hidden],
.source-table[hidden],
.source-catalog-schema[hidden] {
  display: none !important;
}

.source-relationship > span small,
.source-relationship > span strong,
.source-relationship > span code {
  display: block;
}

.source-relationship > span small {
  color: var(--graphite-500);
  font-size: 0.5rem;
  font-weight: 850;
  text-transform: uppercase;
}

.source-relationship > span strong {
  margin-top: 3px;
  font-size: 0.63rem;
  overflow-wrap: anywhere;
}

.source-relationship > span code {
  margin-top: 4px;
  color: var(--orange-700);
  font-size: 0.53rem;
}

.source-relationship > i {
  color: var(--orange-500);
  font-size: 1rem;
  font-style: normal;
  text-align: center;
}

.source-catalog-empty {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 150px;
  padding: 25px;
}

.source-catalog-empty > span {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 16px;
  background: var(--orange-50);
  color: var(--orange-600);
  font-size: 0.82rem;
  font-weight: 900;
  place-items: center;
}

.source-catalog-empty h3 {
  margin: 0;
  font-size: 0.88rem;
}

.source-catalog-empty p {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--graphite-500);
  font-size: 0.63rem;
  line-height: 1.55;
}

body.source-is-loading {
  overflow: hidden;
}

body.source-page-is-loading {
  overflow: hidden;
}

body.source-page-is-loading .app-shell {
  pointer-events: none;
  user-select: none;
}

.source-page-loading {
  z-index: 140;
}

.source-page-loading__pulse {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 20px 0 14px;
}

.source-page-loading__pulse i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #315d87);
  animation: source-page-loading-pulse 900ms ease-in-out infinite alternate;
}

.source-page-loading__pulse i:nth-child(2) { animation-delay: 180ms; }
.source-page-loading__pulse i:nth-child(3) { animation-delay: 360ms; }

.source-page-loading small {
  color: var(--graphite-500);
  font-size: .53rem;
}

@keyframes source-page-loading-pulse {
  from { opacity: .28; transform: translateY(2px) scale(.82); }
  to { opacity: 1; transform: translateY(-2px) scale(1); }
}

.source-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  padding: 24px;
  background: rgb(15 23 42 / 76%);
  opacity: 0;
  backdrop-filter: blur(8px);
  transition: opacity 180ms ease;
  place-items: center;
}

.source-loading-overlay[hidden] {
  display: none;
}

.source-loading-overlay.is-visible {
  opacity: 1;
}

.source-loading-card {
  width: min(100%, 590px);
  padding: 30px;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgb(15 23 42 / 35%);
  text-align: center;
  transform: translateY(12px) scale(0.98);
  transition: transform 200ms ease;
}

.source-loading-overlay.is-visible .source-loading-card {
  transform: translateY(0) scale(1);
}

.source-loading-database {
  position: relative;
  width: 90px;
  height: 82px;
  margin: 0 auto 18px;
}

.source-loading-database span {
  position: absolute;
  left: 18px;
  width: 54px;
  height: 22px;
  border: 2px solid var(--orange-500);
  border-radius: 50%;
  background: var(--orange-50);
  animation: source-database-pulse 1.5s ease-in-out infinite;
}

.source-loading-database span:nth-child(1) { top: 8px; }
.source-loading-database span:nth-child(2) { top: 29px; animation-delay: 150ms; }
.source-loading-database span:nth-child(3) { top: 50px; animation-delay: 300ms; }

.source-loading-database i {
  position: absolute;
  inset: -2px;
  border: 1px dashed rgb(249 115 22 / 38%);
  border-radius: 50%;
  animation: cognarquia-loading-spin 4s linear infinite;
}

.source-loading-card h3 {
  margin: 0;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}

.source-loading-card > p {
  min-height: 38px;
  margin: 8px auto 18px;
  color: var(--graphite-500);
  font-size: 0.67rem;
  line-height: 1.55;
}

.source-loading-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-loading-steps li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  padding: 9px 8px;
  border: 1px solid var(--graphite-200);
  border-radius: 9px;
  color: var(--graphite-400);
  font-size: 0.52rem;
  font-weight: 800;
  text-align: left;
}

.source-loading-steps li > i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--graphite-300);
}

.source-loading-steps li.is-active {
  border-color: var(--orange-200);
  background: var(--orange-50);
  color: var(--orange-700);
}

.source-loading-steps li.is-active > i {
  background: var(--orange-500);
  animation: cognarquia-loading-pulse 1.2s ease-in-out infinite;
}

.source-loading-steps li.is-complete {
  border-color: #bbf7d0;
  color: #15803d;
}

.source-loading-steps li.is-complete > i {
  background: #22c55e;
}

.source-loading-card .chat-loading-card__footer {
  margin-top: 18px;
}

@keyframes source-database-pulse {
  50% {
    border-color: var(--orange-700);
    background: var(--orange-100);
    transform: scale(1.04);
  }
}

@media (max-width: 1180px) {
  .source-grid,
  .source-form-shell,
  .source-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .source-metrics,
  .source-catalog-metrics,
  .source-form__grid,
  .source-form__grid--host,
  .source-schema-list {
    grid-template-columns: 1fr;
  }

  .source-catalog-heading,
  .source-health,
  .source-schema-form__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .source-health form {
    margin-left: 0;
  }

  .source-search {
    width: 100%;
  }

  .source-filter-bar,
  .source-relationship-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .source-filter-select select {
    width: 100%;
  }

  .source-filter-result {
    margin-left: 0;
    padding: 2px;
  }

  .source-pagination {
    justify-content: space-between;
  }

  .source-table__volume {
    display: none;
  }

  .source-table__content {
    overflow-x: auto;
    padding-left: 0;
  }

  .source-column-table {
    min-width: 650px;
  }

  .source-relationship {
    grid-template-columns: 1fr;
  }

  .source-relationship > i {
    transform: rotate(90deg);
  }

  .source-loading-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .source-grid {
    grid-template-columns: 1fr;
  }

  .source-card__heading {
    flex-wrap: wrap;
  }

  .source-status {
    margin-left: 54px;
  }

  .source-loading-overlay {
    align-items: end;
    padding: 10px;
  }

  .source-loading-card {
    padding: 24px 17px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .source-loading-database span,
  .source-loading-database i,
  .source-loading-steps li.is-active > i {
    animation: none;
  }
}

/* Administração de usuários e agentes internos */
.settings-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.settings-summary__card {
  padding: 17px 19px;
  border: 1px solid var(--graphite-200);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-summary__card small,
.settings-summary__card strong,
.settings-summary__card span {
  display: block;
}

.settings-summary__card small {
  color: var(--graphite-500);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.settings-summary__card strong {
  margin-top: 9px;
  font-size: 1.2rem;
  letter-spacing: -0.04em;
}

.settings-summary__card span {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.58rem;
}

.settings-summary__card--orange strong {
  color: var(--orange-600);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

.settings-card {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  padding: 24px;
}

.settings-card::after {
  position: absolute;
  top: -70px;
  right: -70px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgb(249 115 22 / 7%);
  content: "";
}

.settings-card__icon {
  display: grid;
  width: 45px;
  height: 45px;
  margin-bottom: 20px;
  border-radius: 13px;
  background: var(--orange-50);
  color: var(--orange-600);
  place-items: center;
}

.settings-card__icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.settings-card h3 {
  margin: 0;
  font-size: 1rem;
}

.settings-card p {
  max-width: 510px;
  min-height: 64px;
  margin: 9px 0 18px;
  color: var(--graphite-500);
  font-size: 0.66rem;
  line-height: 1.62;
}

.settings-card > a {
  color: var(--orange-600);
  font-size: 0.66rem;
  font-weight: 900;
}

.settings-card--locked {
  opacity: 0.72;
}

.settings-card__permission {
  color: var(--graphite-500);
  font-size: 0.59rem;
  font-weight: 750;
}

.settings-list-panel {
  overflow: hidden;
}

.settings-user-list {
  display: grid;
}

.settings-user-row {
  display: grid;
  grid-template-columns: 42px minmax(150px, 0.8fr) minmax(220px, 1.5fr) minmax(120px, 0.6fr) auto;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--graphite-100);
  transition: background 140ms ease;
}

.settings-user-row:last-child {
  border-bottom: 0;
}

.settings-user-row:hover {
  background: var(--orange-50);
}

.settings-user-row__avatar {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: var(--surface);
  font-size: 0.62rem;
  font-weight: 900;
  place-items: center;
}

.settings-user-row__identity strong,
.settings-user-row__identity small,
.settings-user-row__login strong,
.settings-user-row__login small {
  display: block;
}

.settings-user-row__identity strong {
  font-size: 0.68rem;
}

.settings-user-row__identity small,
.settings-user-row__login small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.54rem;
}

.settings-user-row__permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.settings-user-row__permissions i {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.49rem;
  font-style: normal;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.settings-user-row__permissions i.is-muted {
  background: var(--graphite-100);
  color: var(--graphite-500);
}

.settings-user-row__login {
  text-align: right;
}

.settings-user-row__login strong {
  margin-top: 3px;
  font-size: 0.56rem;
}

.settings-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  gap: 17px;
  align-items: start;
}

.settings-editor--agent {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
}

.settings-editor__side {
  display: grid;
  gap: 12px;
}

.settings-form-body {
  padding: 19px 21px;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-editor input[readonly] {
  background: var(--graphite-100);
  color: var(--graphite-600);
  cursor: not-allowed;
}

.settings-toggle,
.settings-permission-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--graphite-200);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.settings-toggle input,
.settings-permission-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 2px;
  accent-color: var(--orange-600);
}

.settings-toggle strong,
.settings-toggle small,
.settings-permission-option strong,
.settings-permission-option small {
  display: block;
}

.settings-toggle strong,
.settings-permission-option strong {
  color: var(--graphite-800);
  font-size: 0.64rem;
}

.settings-toggle small,
.settings-permission-option small {
  margin-top: 3px;
  color: var(--graphite-500);
  font-size: 0.55rem;
  line-height: 1.45;
}

.settings-permissions {
  display: grid;
  gap: 9px;
}

.settings-superuser-note {
  padding: 11px 12px;
  border-radius: 9px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.59rem;
  font-weight: 750;
  line-height: 1.5;
}

.settings-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.internal-agent-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
  padding: 12px 15px;
  border: 1px solid #fed7aa;
  border-radius: 11px;
  background: var(--orange-50);
  color: var(--orange-800, #9a3412);
}

.internal-agent-notice strong {
  font-size: 0.63rem;
  white-space: nowrap;
}

.internal-agent-notice span {
  font-size: 0.58rem;
  line-height: 1.45;
}

.internal-agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.internal-agent-card {
  overflow: hidden;
}

.internal-agent-card.is-inactive {
  opacity: 0.68;
}

.internal-agent-card__heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--graphite-100);
}

.internal-agent-card__order {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 0.61rem;
  font-weight: 900;
  place-items: center;
}

.internal-agent-card__heading > div {
  min-width: 0;
}

.internal-agent-card__heading small,
.internal-agent-card__heading h3 {
  display: block;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.internal-agent-card__heading small {
  color: var(--orange-600);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.internal-agent-card__heading h3 {
  margin-top: 4px;
  font-size: 0.76rem;
}

.internal-agent-card__heading .source-status {
  margin-left: auto;
}

.internal-agent-card > p {
  min-height: 58px;
  margin: 0;
  padding: 16px 19px;
  color: var(--graphite-600);
  font-size: 0.63rem;
  line-height: 1.55;
}

.internal-agent-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0 19px 16px;
}

.internal-agent-card dl > div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--graphite-100);
}

.internal-agent-card dt,
.internal-agent-card dd {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.internal-agent-card dt {
  color: var(--graphite-500);
  font-size: 0.48rem;
  font-weight: 850;
  text-transform: uppercase;
}

.internal-agent-card dd {
  margin-top: 4px;
  color: var(--graphite-700);
  font-size: 0.54rem;
  font-weight: 800;
}

.internal-agent-card > a {
  display: block;
  padding: 13px 19px 16px;
  border-top: 1px solid var(--graphite-100);
  color: var(--orange-600);
  font-size: 0.62rem;
  font-weight: 900;
}

@media (max-width: 1100px) {
  .settings-editor,
  .settings-editor--agent {
    grid-template-columns: 1fr;
  }

  .settings-user-row {
    grid-template-columns: 42px minmax(150px, 0.8fr) minmax(200px, 1.2fr) auto;
  }

  .settings-user-row__login {
    display: none;
  }
}

@media (max-width: 760px) {
  .settings-summary,
  .settings-grid,
  .internal-agent-grid,
  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-user-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .settings-user-row__permissions {
    display: none;
  }

  .internal-agent-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

.source-query-catalog {
  margin-top: 1.3rem;
}

.source-query-catalog .source-catalog-heading p {
  margin: 0.35rem 0 0;
  color: var(--graphite-500);
  font-size: 0.65rem;
}

.source-query-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.source-query-card {
  min-width: 0;
  padding: 1.2rem;
}

.source-query-card header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.source-query-card header small,
.source-query-card header code {
  display: block;
}

.source-query-card header small {
  color: var(--graphite-500);
  font-size: 0.54rem;
  font-weight: 850;
  text-transform: uppercase;
}

.source-query-card header code {
  margin-top: 0.3rem;
  color: var(--orange-600);
  font-size: 0.66rem;
}

.source-query-card header i {
  height: fit-content;
  padding: 0.35rem 0.55rem;
  color: #15803d;
  border-radius: 999px;
  background: #f0fdf4;
  font-size: 0.54rem;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.source-query-card h4 {
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.source-query-card > p,
.source-query-empty p {
  color: var(--graphite-500);
  font-size: 0.65rem;
  line-height: 1.55;
}

.source-query-card dl {
  display: grid;
  grid-template-columns: 0.8fr 0.55fr 1.25fr;
  gap: 0.55rem;
  margin: 1rem 0;
}

.source-query-card dl div {
  min-width: 0;
  padding: 0.65rem;
  border-radius: 9px;
  background: var(--graphite-100);
}

.source-query-card dt {
  color: var(--graphite-500);
  font-size: 0.48rem;
  font-weight: 850;
  text-transform: uppercase;
}

.source-query-card dd {
  overflow: hidden;
  margin: 0.3rem 0 0;
  font-size: 0.58rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-query-card details {
  border-top: 1px solid var(--graphite-200);
  padding-top: 0.8rem;
}

.source-query-card summary {
  color: var(--orange-600);
  font-size: 0.62rem;
  font-weight: 850;
  cursor: pointer;
}

.source-query-card details > strong {
  display: block;
  margin: 0.9rem 0 0.4rem;
  font-size: 0.58rem;
}

.source-query-card pre {
  overflow: auto;
  max-height: 310px;
  margin: 0;
  padding: 0.8rem;
  border-radius: 9px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.58rem;
  line-height: 1.55;
  white-space: pre;
}

.source-query-empty {
  grid-column: 1 / -1;
  padding: 1.2rem;
}

@media (max-width: 860px) {
  .source-query-grid,
  .source-query-card dl {
    grid-template-columns: 1fr;
  }
}

.source-ingestion { margin-bottom: 1rem; padding: .9rem; border: 1px solid var(--graphite-200); border-radius: 10px; background: #f8fafc; }
.source-ingestion header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.source-ingestion header small { display: block; margin-top: .2rem; color: var(--graphite-500); }
.source-ingestion[aria-busy="true"] { opacity: .78; }
.source-ingestion__feedback { margin: .7rem 0 0; padding: .55rem .7rem; border-radius: 7px; background: #e8f0fe; color: #244b7a; font-size: .62rem; font-weight: 700; }
.source-ingestion__feedback[data-state="success"] { background: #e7f6ed; color: #17643a; }
.source-ingestion__feedback[data-state="error"] { background: #fdecec; color: #9b2626; }
.source-ingestion__configuration { margin-top: .8rem; padding: .8rem; border: 1px solid var(--graphite-200); border-radius: 10px; background: #fff; }
.source-ingestion__configuration-heading strong { font-size: .68rem; }
.source-ingestion__configuration-heading small { display: block; margin-top: .2rem; color: var(--graphite-500); font-size: .55rem; }
.source-ingestion__unified-status { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--graphite-200); }
.source-ingestion__unified-status small { color: var(--graphite-500); font-size: .53rem; }
.source-ingestion__plan { margin-top: .8rem; padding: .8rem; border: 1px solid #d8e1ec; border-radius: 9px; background: #fff; }
.source-ingestion__plan-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.source-ingestion__plan-heading small, .source-ingestion__form-heading small { display: block; margin-top: .2rem; color: var(--graphite-500); font-size: .55rem; }
.source-ingestion__plan-status { flex: 0 0 auto; padding: .28rem .5rem; border-radius: 999px; font-size: .5rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.source-ingestion__plan-status[data-state="approved"] { background: #e7f6ed; color: #17643a; }
.source-ingestion__plan-status[data-state="blocked"] { background: #fdecec; color: #9b2626; }
.source-ingestion__plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; margin: .75rem 0 0; }
.source-ingestion__plan-grid > div { min-width: 0; padding: .55rem; border-radius: 7px; background: #f4f7fa; }
.source-ingestion__plan-grid dt { color: var(--graphite-500); font-size: .48rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.source-ingestion__plan-grid dd { overflow-wrap: anywhere; margin: .2rem 0 0; color: var(--graphite-900); font-size: .62rem; font-weight: 800; }
.source-ingestion__metrics { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--graphite-200); }
.source-ingestion__metrics strong { width: 100%; font-size: .55rem; }
.source-ingestion__metrics span { padding: .3rem .45rem; border-radius: 6px; background: #e8f0fe; color: #244b7a; font-size: .5rem; font-weight: 700; }
.source-ingestion__form-heading { margin-top: .9rem; }
.source-ingestion__form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin-top: .8rem; }
.source-ingestion__form label { color: var(--graphite-500); font-size: .55rem; font-weight: 800; }
.source-ingestion__form input, .source-ingestion__form select { width: 100%; margin-top: .25rem; padding: .5rem; border: 1px solid var(--graphite-200); border-radius: 7px; }
.source-ingestion__form .source-ingestion__readonly input { border-color: #dce5ef; background: #f2f6fa; color: #29445f; font-weight: 800; cursor: default; }
.source-ingestion__form .source-ingestion__check { display: flex; align-items: center; gap: .35rem; }
.source-ingestion__form .source-ingestion__check input { width: auto; margin: 0; }
.source-ingestion__save { grid-column: 1 / -1; justify-self: end; margin-top: .25rem; }
.source-ingestion__execute { display: flex; justify-content: flex-end; margin-top: .55rem; }
.source-ingestion__runs { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.source-ingestion__runs > strong { width: 100%; font-size: .58rem; }
.source-ingestion__run { flex: 1 1 260px; min-width: 0; padding: .35rem .5rem; border-radius: 6px; background: var(--graphite-100); font-size: .52rem; }
.source-ingestion__run-summary { display: block; }
.source-ingestion__error-detail { margin-top: .4rem; border-top: 1px solid #efcaca; padding-top: .4rem; }
.source-ingestion__error-detail summary { width: fit-content; cursor: pointer; color: #9b2626; font-weight: 900; }
.source-ingestion__error-detail p { margin: .45rem 0; color: #7f1d1d; font-size: .56rem; font-weight: 750; }
.source-ingestion__error-detail pre { max-height: 260px; overflow: auto; margin: 0; padding: .6rem; border-radius: 6px; background: #172033; color: #e5edf8; font: .5rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.source-ingestion__run > small { display: block; margin-top: .25rem; color: var(--graphite-500); }
.source-ingestion__semantic { margin-top: .75rem; padding: .7rem; border: 1px solid #d8e3f2; border-radius: 9px; background: #f7faff; }
.source-ingestion__semantic > div { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.source-ingestion__semantic > div strong { font-size: .62rem; }
.source-ingestion__semantic > div span { padding: .25rem .45rem; border-radius: 999px; background: #e8f0fe; color: #244b7a; font-size: .48rem; font-weight: 900; text-transform: uppercase; }
.source-ingestion__semantic p { margin: .45rem 0 0; color: #334155; font-size: .56rem; }
.source-ingestion__semantic small { display: block; margin-top: .35rem; color: var(--graphite-500); }
.source-ingestion__semantic[data-semantic-state="validated"] { border-color: #b9dfc7; background: #f2fbf5; }
.source-ingestion__semantic[data-semantic-state="needs_review"], .source-ingestion__semantic[data-semantic-state="failed"] { border-color: #efcaca; background: #fff7f7; }
.source-ingestion__semantic details { margin-top: .45rem; font-size: .54rem; }
.source-ingestion__semantic li { margin-top: .25rem; }
.source-ingestion-batch { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin: 0 0 1rem; padding: .85rem; border: 1px solid var(--graphite-200); border-radius: 10px; background: #fff; }
.source-ingestion-batch > div:first-child { flex: 1 1 280px; }
.source-ingestion-batch > div:first-child small { display: block; margin-top: .2rem; color: var(--graphite-500); }
.source-ingestion-batch > p { flex-basis: 100%; margin: 0; padding: .55rem .7rem; border-radius: 7px; background: #e8f0fe; color: #244b7a; font-size: .62rem; font-weight: 700; }
.source-ingestion-batch > p[data-state="success"] { background: #e7f6ed; color: #17643a; }
.source-ingestion-batch > p[data-state="error"] { background: #fdecec; color: #9b2626; }
.source-batch-monitor { flex-basis: 100%; padding: 1rem; border: 1px solid #d8e3f2; border-radius: 12px; background: linear-gradient(145deg, #fff 0%, #f7faff 100%); box-shadow: 0 8px 24px rgb(27 67 112 / 6%); }
.source-batch-monitor header { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.source-batch-monitor header span, .source-batch-monitor header small { display: block; }
.source-batch-monitor header strong { font-size: .82rem; }
.source-batch-monitor header small { margin-top: .2rem; color: var(--graphite-500); font-size: .58rem; }
.source-batch-monitor progress { width: 100%; height: .8rem; margin: .85rem 0 .8rem; overflow: hidden; border: 0; border-radius: 999px; background: #dfe8f4; accent-color: #2563a8; }
.source-batch-monitor progress::-webkit-progress-bar { border-radius: 999px; background: #dfe8f4; }
.source-batch-monitor progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #2563a8, #3b82c4); }
.source-batch-monitor progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #2563a8, #3b82c4); }
.source-batch-monitor__counts { display: grid; grid-template-columns: repeat(5, minmax(85px, 1fr)); gap: .55rem; }
.source-batch-monitor__counts span { display: flex; min-height: 58px; flex-direction: column; justify-content: center; padding: .6rem .7rem; border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; }
.source-batch-monitor__counts strong { color: #1e293b; font-size: 1rem; line-height: 1; }
.source-batch-monitor__counts small { margin-top: .3rem; color: #64748b; font-size: .53rem; font-weight: 800; text-transform: uppercase; }
.source-batch-monitor__counts span[data-kind="completed"] { border-color: #bbf7d0; background: #f0fdf4; }
.source-batch-monitor__counts span[data-kind="completed"] strong { color: #15803d; }
.source-batch-monitor__counts span[data-kind="running"] { border-color: #bfdbfe; background: #eff6ff; }
.source-batch-monitor__counts span[data-kind="running"] strong { color: #1d4ed8; }
.source-batch-monitor__counts span[data-kind="failed"] { border-color: #fecaca; background: #fef2f2; }
.source-batch-monitor__counts span[data-kind="failed"] strong { color: #b91c1c; }
.source-batch-monitor__counts span[data-kind="blocked"] { border-color: #fde68a; background: #fffbeb; }
.source-batch-monitor__counts span[data-kind="blocked"] strong { color: #a16207; }
.source-batch-monitor details { margin-top: .65rem; font-size: .58rem; }
.source-batch-monitor__problems { max-height: 16rem; margin-top: .45rem; overflow: auto; }
.source-batch-monitor__problem { display: grid; grid-template-columns: minmax(120px, .35fr) 1fr; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--graphite-200); }
@media (max-width: 680px) { .source-batch-monitor__problem { grid-template-columns: 1fr; } .source-batch-monitor__counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .source-ingestion__plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .source-ingestion__form, .source-ingestion__plan-grid { grid-template-columns: 1fr; }
  .source-ingestion__plan-heading { align-items: stretch; flex-direction: column; }
  .source-ingestion__plan-status { align-self: flex-start; }
}


.source-batch-monitor__actions { display: flex; align-items: center; gap: .5rem; }
@media (max-width: 760px) {
  .source-filter-bar { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; position: relative; }
  .source-filter-bar .source-search, .source-filter-result { grid-column: 1 / -1; }
  .source-search input, .source-filter-select select { min-width: 0; width: 100%; font-size: 16px; }
  .source-ingestion-batch { align-items: stretch; flex-direction: column; padding: .75rem; }
  .source-ingestion-batch > div:first-child { flex-basis: auto; }
  .source-ingestion-batch > form, .source-ingestion-batch > form .button { width: 100%; }
  .source-batch-monitor { padding: .75rem; }
  .source-batch-monitor header { align-items: stretch; flex-direction: column; }
  .source-batch-monitor__actions, .source-batch-monitor__actions .button { width: 100%; }
  .source-batch-monitor__actions .button { flex: 1 1 0; }
}
@media (max-width: 390px) {
  .source-filter-bar { grid-template-columns: 1fr; }
  .source-filter-bar .source-search, .source-filter-result { grid-column: auto; }
}


.source-catalog[data-loading="true"] {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 120ms ease;
}


.source-filter-submit { min-height: 40px; align-self: end; }
.source-catalog-shell { position: relative; min-height: 120px; }
.source-catalog-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: .65rem;
  padding-top: 2rem;
  border-radius: 14px;
  background: rgb(248 250 252 / 82%);
  color: var(--graphite-700);
  backdrop-filter: blur(2px);
}
.source-catalog-loading[hidden] { display: none; }
.source-catalog-loading__spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--graphite-200);
  border-top-color: var(--orange-500);
  border-radius: 50%;
  animation: source-catalog-spin .7s linear infinite;
}
@keyframes source-catalog-spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .source-filter-submit { width: 100%; }
}
