:root {
  --geral-orange: #ff7a18;
  --geral-orange-dark: #e56a0f;
  --geral-orange-light: #fff4eb;
  --geral-text: #212b36;
  --geral-muted: #637381;
  --geral-border: #dfe3e8;
  --geral-danger: #ff5630;
  --geral-success: #22c55e;
  --geral-radius: 12px;
  --geral-shadow: 0 12px 24px rgba(145, 158, 171, 0.12);
  --geral-sidebar-width: 280px;
  --geral-sidebar-width-collapsed: 80px;
  --geral-topbar-height: 64px;
  --geral-active-green: #00a76f;
  --geral-active-green-bg: #e9faf2;
  font-family: "Public Sans", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--geral-text);
  background: #f4f6f8;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--geral-orange-light) 0%, #ffffff 55%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--geral-radius);
  box-shadow: var(--geral-shadow);
  padding: 40px 32px 32px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-logo img {
  max-width: 180px;
  height: auto;
}

.auth-brand,
.app-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--geral-orange);
  letter-spacing: -0.02em;
}

.auth-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

.auth-subtitle {
  margin: 0 0 24px;
  text-align: center;
  color: var(--geral-muted);
  font-size: 0.95rem;
}

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

.form-hint {
  color: var(--geral-muted);
  font-size: 0.875rem;
  margin: 0 0 8px;
}

.story-code-filter {
  margin-bottom: 8px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.field-required {
  color: var(--geral-danger);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--geral-border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--geral-orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.2);
}

.form-control.is-invalid {
  border-color: var(--geral-danger);
}

.field-error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--geral-danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
  width: 100%;
  background: var(--geral-orange);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--geral-orange-dark);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-link {
  background: transparent;
  color: var(--geral-orange);
  padding: 0;
  font-weight: 600;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.alert-success {
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #abefc6;
}

.alert-error {
  background: #fff2f0;
  color: #b42318;
  border: 1px solid #fecdca;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--geral-orange);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-primary.is-loading .spinner {
  display: inline-block;
}

.btn-primary.is-loading .btn-label {
  opacity: 0.85;
}

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

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

/* Sidebar */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--geral-sidebar-width);
  background: #fff;
  border-right: 1px solid var(--geral-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease, transform 0.2s ease;
}

.app-sidebar.is-collapsed {
  width: var(--geral-sidebar-width-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--geral-topbar-height);
  padding: 0 12px 0 20px;
  flex-shrink: 0;
}

.sidebar-header .app-brand {
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar.is-collapsed .sidebar-header {
  justify-content: center;
  padding: 0 8px;
}

.app-sidebar.is-collapsed .sidebar-header .app-brand {
  display: none;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--geral-border);
  border-radius: 50%;
  background: #fff;
  color: var(--geral-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.2s;
}

.sidebar-toggle:hover {
  background: #f4f6f8;
  color: var(--geral-text);
}

.app-sidebar.is-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.app-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-nav-section {
  display: block;
  padding: 16px 12px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--geral-muted);
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar.is-collapsed .app-nav-section {
  text-align: center;
  padding: 16px 4px 8px;
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--geral-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, color 0.15s;
}

.app-nav-item:hover {
  background: #f4f6f8;
}

.app-nav-item.is-active {
  background: var(--geral-active-green-bg);
  color: var(--geral-active-green);
}

.app-nav-item.is-active .app-nav-icon {
  color: var(--geral-active-green);
}

.app-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--geral-muted);
}

.app-nav-item:hover .app-nav-icon,
.app-nav-item.is-active .app-nav-icon {
  color: inherit;
}

.app-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar.is-collapsed .app-nav-item {
  justify-content: center;
  padding: 9px 0;
}

.app-sidebar.is-collapsed .app-nav-label {
  display: none;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--geral-border);
  flex-shrink: 0;
}

.app-nav-item--logout {
  color: var(--geral-danger);
}

/* Content area + topbar */
.app-content-wrap {
  flex: 1;
  margin-left: var(--geral-sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.app-sidebar.is-collapsed ~ .app-content-wrap {
  margin-left: var(--geral-sidebar-width-collapsed);
}

.app-topbar {
  height: var(--geral-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--geral-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-spacer {
  flex: 1;
}

.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--geral-text);
  cursor: pointer;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--geral-text);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.topbar-icon-btn:hover {
  background: #f4f6f8;
}

.topbar-icon-btn--notif::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--geral-orange);
  border: 1.5px solid #fff;
}

.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--geral-orange-light);
  color: var(--geral-orange-dark);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
}

.app-main {
  flex: 1;
  padding: 24px 32px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 960px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--geral-sidebar-width);
    box-shadow: var(--geral-shadow);
  }

  .app-sidebar.is-collapsed {
    width: var(--geral-sidebar-width);
  }

  .app-sidebar.is-collapsed .sidebar-header .app-brand,
  .app-sidebar.is-collapsed .app-nav-label,
  .app-sidebar.is-collapsed .app-nav-section {
    display: block;
  }

  .app-sidebar.is-collapsed .app-nav-item,
  .app-sidebar.is-collapsed .sidebar-header {
    justify-content: flex-start;
    padding: 9px 12px;
  }

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

  .sidebar-toggle {
    display: none;
  }

  .app-content-wrap,
  .app-sidebar.is-collapsed ~ .app-content-wrap {
    margin-left: 0;
  }

  .topbar-menu-btn {
    display: inline-flex;
  }
}

.dashboard-card {
  background: #fff;
  border-radius: var(--geral-radius);
  box-shadow: var(--geral-shadow);
  padding: 28px;
}

/* Dashboard: grid de duas colunas */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

.dashboard-col {
  min-width: 0;
}

.dashboard-col .dashboard-card {
  height: 100%;
}

.dashboard-widget {
  display: flex;
  flex-direction: column;
  padding: 24px 0 12px;
}

.dashboard-widget-header {
  padding: 0 24px 16px;
  border-bottom: 1px solid var(--geral-border);
  margin-bottom: 4px;
}

.dashboard-widget-header--with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-widget-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-icon-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--geral-orange-light);
  color: var(--geral-orange-dark);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-icon-add:hover {
  background: var(--geral-orange);
  color: #fff;
}

.btn-icon-add:active {
  transform: scale(0.94);
}

.widget-activity-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.widget-activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px 12px 14px;
  border-bottom: 1px dashed var(--geral-border);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
  position: relative;
}

.widget-activity-item:last-child {
  border-bottom: none;
}

.widget-activity-item .activity-complete-form {
  margin: 0;
  flex-shrink: 0;
}

.widget-activity-item--submitting {
  opacity: 0.6;
  pointer-events: none;
}

.widget-activity-item--completed .widget-activity-title {
  color: var(--geral-muted);
  text-decoration: line-through;
}

.widget-activity-item--completed .widget-activity-handle {
  visibility: hidden;
}

.widget-activity-item--moving {
  opacity: 0;
  transform: translateY(-6px);
}

.widget-activity-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex-shrink: 0;
  color: var(--geral-border);
  cursor: grab;
  touch-action: none;
}

.widget-activity-handle:hover {
  color: var(--geral-muted);
}

.widget-activity-item--dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.widget-activity-item--dragging .widget-activity-handle {
  cursor: grabbing;
}

.widget-activity-item--drop-target {
  background: var(--geral-active-green-bg, #f4f6f8);
}

.widget-activity-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.widget-activity-title {
  font-size: 0.9rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.widget-activity-meta {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--geral-muted);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.widget-activity-title[contenteditable="true"] {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  outline: none;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  background: var(--geral-orange-light);
  cursor: text;
}

/* Menu de ações (3 pontinhos) */
.widget-activity-menu {
  position: relative;
  flex-shrink: 0;
}

.widget-activity-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--geral-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.widget-activity-menu-btn:hover,
.widget-activity-menu.is-open .widget-activity-menu-btn {
  background: #f4f6f8;
  color: var(--geral-text);
}

.widget-activity-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--geral-shadow);
  border: 1px solid var(--geral-border);
  padding: 6px;
  z-index: 20;
}

.widget-activity-menu.is-open .widget-activity-dropdown {
  display: block;
}

.widget-activity-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--geral-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.widget-activity-dropdown-item:hover {
  background: #f4f6f8;
}

.widget-activity-dropdown-item--danger {
  color: var(--geral-danger);
}

.widget-activity-dropdown-item--danger:hover {
  background: #fff1ee;
}

.confirm-modal-text {
  color: var(--geral-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.dashboard-widget .activities-empty {
  padding: 4px 24px 16px;
}

.dashboard-widget-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 16px 24px 4px;
  align-self: flex-end;
  color: var(--geral-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.875rem;
}

.dashboard-widget-link:hover {
  color: var(--geral-orange-dark);
}

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

  .dashboard-col--side .dashboard-widget {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .widget-activity-item {
    padding: 10px 20px 10px 12px;
  }

  .widget-activity-title {
    font-size: 0.85rem;
  }

  .widget-activity-meta {
    font-size: 0.7rem;
  }
}

.role-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--geral-orange-light);
  color: var(--geral-orange-dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-secondary {
  background: #fff;
  color: var(--geral-text);
  border: 1px solid var(--geral-border);
}

.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.875rem;
  width: auto;
}

.btn-xs {
  padding: 0;
  font-size: 0.8rem;
}

.agenda-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.agenda-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.agenda-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.agenda-subtitle {
  margin: 0;
  color: var(--geral-muted);
}

.agenda-toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.agenda-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 18px 24px;
}

.agenda-summary-item {
  color: var(--geral-muted);
  font-size: 0.9rem;
}

.agenda-summary-item strong {
  color: var(--geral-text);
}

.agenda-summary-item--overtime strong {
  color: var(--geral-orange-dark);
}

.agenda-he-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.4;
  padding: 1px 5px;
  margin-left: 4px;
  border-radius: 4px;
  background: var(--geral-orange-light);
  color: var(--geral-orange-dark);
  vertical-align: middle;
}

.agenda-entry-overtime {
  background: var(--geral-orange-light);
  border-radius: 6px;
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}

.agenda-loading,
.agenda-empty {
  text-align: center;
  color: var(--geral-muted);
}

.agenda-days {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.agenda-day-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.agenda-day-date {
  margin: 0;
  font-size: 1.2rem;
}

.agenda-day-total {
  color: var(--geral-orange-dark);
  font-weight: 600;
  font-size: 0.9rem;
}

.agenda-node-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.agenda-node-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.agenda-entry-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.agenda-action-sep {
  color: #c5cdd5;
  margin: 0 2px;
  user-select: none;
  font-size: 0.85rem;
  font-weight: 400;
}

.agenda-story {
  margin-top: 16px;
  padding-top: 0;
  border-top: none;
}

.agenda-story:first-of-type {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--geral-border);
}

.agenda-story:nth-of-type(even) {
  background: #f8fafc;
  border-radius: 8px;
  margin-left: -12px;
  margin-right: -12px;
  padding: 12px 12px 4px;
}

.agenda-story:nth-of-type(even):first-of-type {
  padding-top: 12px;
}

.agenda-story-title {
  margin: 0;
  font-size: 1rem;
  color: var(--geral-text);
}

.agenda-task {
  margin: 12px 0 0 16px;
  padding-left: 12px;
  border-left: 3px solid var(--geral-orange-light);
}

.agenda-task-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.agenda-entries {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.agenda-entry {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f4f6f8;
  flex-wrap: wrap;
}

.agenda-entry-hours {
  font-weight: 700;
  color: var(--geral-orange-dark);
  min-width: 36px;
}

.agenda-entry-desc {
  flex: 1;
  font-size: 0.9rem;
}

.agenda-entry-actions {
  display: flex;
  gap: 6px;
}

.agenda-notes-section h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.agenda-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.agenda-note {
  padding: 16px 0;
  border-bottom: 1px solid var(--geral-border);
}

.agenda-note:last-child {
  border-bottom: none;
}

.agenda-note header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.agenda-note-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--geral-muted);
  margin-top: 4px;
}

.agenda-note p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--geral-muted);
}

.agenda-modal {
  border: none;
  border-radius: var(--geral-radius);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: var(--geral-shadow);
}

.agenda-modal::backdrop {
  background: rgba(33, 43, 54, 0.45);
}

.agenda-modal form {
  padding: 24px;
}

.agenda-modal h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.agenda-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.agenda-modal .btn-primary {
  width: auto;
}

.agenda-modal .btn-primary .spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.agenda-modal--confirm {
  max-width: 420px;
  padding: 24px;
}

.agenda-modal--confirm h2 {
  margin: 0 0 12px;
}

.agenda-modal--confirm .confirm-modal-text {
  margin: 0 0 20px;
}

.agenda-modal--confirm .agenda-modal-actions {
  margin-top: 0;
}

.agenda-modal--confirm .btn-danger {
  width: auto;
}

.agenda-modal--confirm .btn-danger .spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.form-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.profile-page {
  width: 100%;
}

.profile-header {
  margin-bottom: 24px;
}

.profile-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 24px;
  width: 100%;
}

.profile-grid .profile-card {
  flex: 1 1 280px;
  min-width: 0;
}

.profile-card-title {
  margin: 0 0 20px;
  font-size: 1.1rem;
}

.profile-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--geral-muted);
}

.profile-card .btn-primary {
  width: auto;
  min-width: 160px;
}

.profile-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.servicenow-status {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.servicenow-status--unknown {
  background: #f4f6f8;
  color: var(--geral-muted);
  border: 1px solid var(--geral-border);
}

.servicenow-status--saved {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
}

.servicenow-status--missing {
  background: #fff8e1;
  color: #8d6e00;
  border: 1px solid #ffe082;
}

.servicenow-status--error {
  background: #fdecea;
  color: #b71c1c;
  border: 1px solid #f5c6cb;
}

.servicenow-status--connected {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
}

.servicenow-status--disconnected {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.servicenow-status--checking {
  background: #f4f6f8;
  color: var(--geral-muted);
  border: 1px solid var(--geral-border);
}

.servicenow-connection-block {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid var(--geral-border);
  border-radius: 12px;
  background: #fafbfc;
}

.servicenow-connection-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.servicenow-connection-block .btn-secondary {
  margin-top: 12px;
}

.servicenow-connection-checks {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.servicenow-connection-checks li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  border-top: 1px solid var(--geral-border);
}

.servicenow-connection-checks li:first-child {
  border-top: none;
  padding-top: 0;
}

.servicenow-connection-checks li::before {
  flex-shrink: 0;
  font-weight: 700;
}

.servicenow-connection-checks li.is-ok::before {
  content: '✓';
  color: #2e7d32;
}

.servicenow-connection-checks li.is-fail::before {
  content: '✗';
  color: #c62828;
}

.servicenow-connection-checks strong {
  display: block;
  font-size: 0.8125rem;
}

.notes-client-filter {
  margin-bottom: 16px;
  padding: 16px 20px;
}

.notes-client-filter-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--geral-text-muted);
}

.notes-client-select {
  max-width: 420px;
}

.notes-client-meta {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--geral-text-muted);
}

.notes-client-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--geral-text-muted);
}

.notes-tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.notes-tabs-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 0;
  border-bottom: 1px solid var(--geral-border);
  margin-bottom: 0;
  scrollbar-width: thin;
}

.notes-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--geral-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}

.notes-tab:hover {
  color: var(--geral-text);
}

.notes-tab.is-active {
  color: var(--geral-orange-dark);
  border-bottom-color: var(--geral-orange);
}

.notes-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--geral-orange-light);
  color: var(--geral-orange-dark);
  font-size: 0.75rem;
  font-weight: 700;
}

.notes-tab-panel {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}

.notes-tab-panel[hidden] {
  display: none;
}

.notes-group-card {
  margin-bottom: 0;
  background: #f0ebe3;
  border: 1px solid #e2d9cc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.notes-tab-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #d4c9b8;
}

.notes-group-description {
  margin: 0;
  color: var(--geral-muted);
  font-size: 0.9rem;
  flex: 1;
}

.notes-group-description--placeholder {
  font-style: italic;
}

.notes-group-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.notes-empty {
  margin: 0;
  color: var(--geral-muted);
  font-size: 0.9rem;
  font-style: italic;
}

.notes-delete-form {
  display: inline;
  margin: 0;
}

.postit-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 4px 2px 8px;
}

.postit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 200px;
  max-height: 200px;
  padding: 18px 16px 14px;
  border-radius: 2px 2px 16px 2px;
  box-shadow:
    2px 3px 8px rgba(33, 43, 54, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.postit-card:nth-child(6n + 1) { transform: rotate(-1.2deg); }
.postit-card:nth-child(6n + 2) { transform: rotate(0.8deg); }
.postit-card:nth-child(6n + 3) { transform: rotate(-0.5deg); }
.postit-card:nth-child(6n + 4) { transform: rotate(1.1deg); }
.postit-card:nth-child(6n + 5) { transform: rotate(-0.9deg); }
.postit-card:nth-child(6n + 6) { transform: rotate(0.4deg); }

.postit-card:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow:
    4px 8px 18px rgba(33, 43, 54, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
  z-index: 1;
}

.postit-card--yellow {
  background: linear-gradient(145deg, #fff9b8 0%, #fef08a 100%);
  color: #5c4a00;
}

.postit-card--pink {
  background: linear-gradient(145deg, #fce7f3 0%, #f9a8d4 100%);
  color: #831843;
}

.postit-card--blue {
  background: linear-gradient(145deg, #dbeafe 0%, #93c5fd 100%);
  color: #1e3a8a;
}

.postit-card--green {
  background: linear-gradient(145deg, #dcfce7 0%, #86efac 100%);
  color: #14532d;
}

.postit-card--orange {
  background: linear-gradient(145deg, #ffedd5 0%, #fdba74 100%);
  color: #7c2d12;
}

.postit-card--lavender {
  background: linear-gradient(145deg, #ede9fe 0%, #c4b5fd 100%);
  color: #4c1d95;
}

.postit-card-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent rgba(0, 0, 0, 0.08) rgba(0, 0, 0, 0.04) transparent;
  border-radius: 0 0 0 2px;
}

.postit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.postit-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.postit-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.postit-card:hover .postit-card-actions,
.postit-card:focus-within .postit-card-actions {
  opacity: 1;
}

.postit-card-action {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  opacity: 0.75;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.postit-card-action:hover {
  opacity: 1;
}

.postit-card-action--danger {
  color: var(--geral-danger);
}

.postit-card-body {
  flex: 1;
  min-height: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
  opacity: 0.92;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.postit-card-meta {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.72rem;
  opacity: 0.65;
  font-weight: 600;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .profile-grid {
    flex-direction: column;
  }

  .auth-card {
    padding: 28px 20px 24px;
  }

  .agenda-entry {
    flex-direction: column;
    align-items: flex-start;
  }

  .postit-board {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .postit-card {
    transform: none !important;
  }

  .postit-card-actions {
    opacity: 1;
    flex-direction: row;
    gap: 8px;
  }

  .notes-tabs-nav {
    margin: 0 -4px;
    padding: 0 4px 0;
  }

  .notes-tab {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .calendar-grid {
    overflow-x: auto;
  }

  .calendar-cell {
    min-height: 100px;
  }
}

.calendar-page .calendar-card {
  padding: 20px 24px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.calendar-month-label {
  margin: 0;
  font-size: 1.25rem;
  text-align: center;
  flex: 1;
}

.calendar-nav-btn {
  min-width: 40px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--geral-border);
  border: 1px solid var(--geral-border);
  border-radius: 10px;
  overflow: hidden;
}

.calendar-weekday {
  background: #f8fafc;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--geral-muted);
}

.calendar-cell {
  background: #fff;
  min-height: 120px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-cell--empty {
  background: #fafbfc;
}

.calendar-cell--today {
  background: var(--geral-orange-light);
}

.calendar-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.calendar-day-number {
  font-weight: 700;
  font-size: 0.9rem;
}

.calendar-add-btn {
  opacity: 0;
  padding: 0 4px;
  min-height: auto;
}

.calendar-cell:hover .calendar-add-btn {
  opacity: 1;
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-event {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  border: none;
  border-radius: 6px;
  background: #fff4eb;
  color: var(--geral-text);
  padding: 4px 6px;
  text-align: left;
  cursor: pointer;
  font-size: 0.72rem;
}

.calendar-event:hover {
  background: #ffe8d4;
}

.calendar-event-time {
  font-weight: 700;
  color: var(--geral-orange-dark);
}

.calendar-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.calendar-event--more {
  background: #eef2f6;
  color: var(--geral-muted);
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-title {
  margin: 0 0 20px;
  font-size: 1.15rem;
}

.btn-danger {
  background: var(--geral-danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #e04a2a;
}

.calendar-delete-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--geral-border);
}

.day-appointments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.day-appointment-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--geral-border);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.day-appointment-item:hover {
  border-color: var(--geral-orange);
  background: var(--geral-orange-light);
}

.day-appointment-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--geral-orange-dark);
}

.day-appointment-title {
  font-size: 0.95rem;
}

.day-appointments-empty {
  color: var(--geral-muted);
  margin: 0;
}

/* Clientes */
.clientes-page .clientes-filters {
  margin-bottom: 16px;
}

.clientes-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.clientes-filter-form .form-group {
  margin-bottom: 0;
  min-width: 180px;
  flex: 1;
}

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

.clientes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.clientes-table th,
.clientes-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--geral-border);
}

.clientes-table th {
  font-weight: 600;
  color: var(--geral-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-muted {
  background: #eef2f6;
  color: var(--geral-muted);
}

.badge-status-ativo {
  background: #dcfce7;
  color: #15803d;
}

.badge-status-inativo {
  background: #f3f4f6;
  color: #6b7280;
}

.badge-status-bloqueado {
  background: #fee2e2;
  color: #b91c1c;
}

.clientes-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.clientes-pagination-info {
  color: var(--geral-muted);
  font-size: 0.875rem;
}

.client-type-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--geral-border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
}

.radio-pill:has(input:checked) {
  border-color: var(--geral-orange);
  background: var(--geral-orange-light);
}

.client-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--geral-border);
}

.client-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.client-section-header h3 {
  margin: 0;
  font-size: 1rem;
}

.address-block,
.contact-block {
  padding: 16px;
  border: 1px solid var(--geral-border);
  border-radius: 8px;
  margin-bottom: 12px;
  background: #fafbfc;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  margin: 8px 0;
}

.form-group-grow {
  flex: 2;
}

.modal-dialog-lg {
  max-width: 720px;
}

.client-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin: 0;
}

.form-control-sm {
  padding: 8px 10px;
  font-size: 0.875rem;
}

.section-title {
  margin: 0 0 20px;
  font-size: 1.1rem;
}

.form-actions {
  margin-top: 20px;
}

.text-danger {
  color: var(--geral-danger);
}

.client-audit-card {
  margin-top: 16px;
}

.activities-section {
  padding: 20px 24px;
}

.activities-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.activities-section-title {
  margin: 0;
  font-size: 1.1rem;
}

.activities-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--geral-surface-2, #f4f6f8);
  color: var(--geral-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.activities-empty {
  margin: 0;
  color: var(--geral-muted);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--geral-border, #e5e8eb);
  border-radius: 10px;
  background: #fff;
  transition: opacity 0.2s ease;
}

.activity-item--submitting {
  opacity: 0.6;
  pointer-events: none;
}

.activity-item--completed {
  opacity: 0.55;
}

.activity-item--completed .activity-title,
.activity-item--completed .activity-description,
.activity-item--completed .activity-meta {
  text-decoration: line-through;
}

.activity-complete-form {
  margin: 0;
  flex-shrink: 0;
}

.activity-checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.activity-checkbox-label--done {
  cursor: default;
}

.activity-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.activity-checkbox-box {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid var(--geral-border, #c4cdd5);
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.activity-checkbox-box::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 6px;
  margin-top: -4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -50%) rotate(-45deg) scale(0);
  transition: transform 0.15s ease;
}

.activity-checkbox:focus-visible + .activity-checkbox-box {
  outline: 2px solid var(--geral-success);
  outline-offset: 2px;
}

.activity-checkbox:checked + .activity-checkbox-box,
.activity-checkbox-box--checked {
  border-color: var(--geral-success);
  background: var(--geral-success);
}

.activity-checkbox:checked + .activity-checkbox-box::after,
.activity-checkbox-box--checked::after {
  transform: translate(-50%, -50%) rotate(-45deg) scale(1);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.activity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(32, 101, 209, 0.1);
  color: var(--geral-primary, #2065d1);
  font-size: 0.75rem;
  font-weight: 600;
}

.activity-badge--muted {
  background: var(--geral-surface-2, #f4f6f8);
  color: var(--geral-muted);
}

.activity-description {
  margin: 6px 0 0;
  color: var(--geral-muted);
  font-size: 0.9rem;
}

.activity-meta {
  margin: 8px 0 0;
  color: var(--geral-muted);
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  .clientes-filter-form {
    flex-direction: column;
    align-items: stretch;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .activity-item {
    padding: 12px;
  }

  .activity-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* --- Agentes IA (cards grid) --- */

.agentes-page {
  max-width: 1200px;
}

.agentes-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: var(--geral-muted);
}

.agentes-breadcrumb a {
  color: var(--geral-muted);
  text-decoration: none;
}

.agentes-breadcrumb a:hover {
  color: var(--geral-text);
}

.agentes-breadcrumb-sep {
  color: #c4cdd5;
}

.agentes-toolbar {
  margin-bottom: 24px;
}

.agentes-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--geral-muted);
}

.agentes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.agent-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 0 2px rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 2px rgba(145, 158, 171, 0.24), 0 20px 40px -4px rgba(145, 158, 171, 0.16);
}

.agent-card--inactive {
  opacity: 0.75;
}

.agent-card-cover {
  height: 120px;
  background-size: cover;
  background-position: center;
}

.agent-card-body {
  padding: 0 24px 24px;
  margin-top: -40px;
  position: relative;
  text-align: center;
}

.agent-card-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.agent-card-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid #fff;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.agent-card-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2065d1 0%, #103996 100%);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.agent-card-name {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--geral-text);
}

.agent-card-role {
  margin: 0 0 4px;
  font-size: 0.875rem;
  color: var(--geral-muted);
}

.agent-card-client {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  color: var(--geral-primary);
  font-weight: 500;
}

.agent-card-model {
  margin: 0 0 16px;
  font-size: 0.75rem;
  color: #9ca3af;
}

.agent-card-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.agent-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  color: #fff;
  text-decoration: none;
}

.agent-control-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.agent-control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.agent-control-btn--start {
  background: #22c55e;
}

.agent-control-btn--stop {
  background: #ef4444;
}

.agent-control-btn--hold {
  background: #f59e0b;
}

.agent-control-btn--profile {
  background: #64748b;
}

.agent-control-btn--profile:hover {
  color: #fff;
}

.agent-control-btn.is-active {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
  transform: scale(1.08);
}

.agent-card[data-agent-runtime="running"] .agent-control-btn--start.is-active {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.agent-card[data-agent-runtime="stopped"] .agent-control-btn--stop.is-active {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}

.agent-card[data-agent-runtime="waiting"] .agent-control-btn--hold.is-active {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35);
}

.agent-card--inactive .agent-card-controls {
  opacity: 0.7;
}

.agent-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--geral-border);
}

.agent-card-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-card-stat-label {
  font-size: 0.75rem;
  color: var(--geral-muted);
}

.agent-card-stat strong {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--geral-text);
}

.btn-link-danger {
  color: #b91c1c;
}

.btn-link-danger:hover {
  color: #991b1b;
}

.agentes-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.agentes-pagination-btn,
.agentes-pagination-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--geral-text);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
}

.agentes-pagination-btn:hover,
.agentes-pagination-page:hover {
  background: rgba(145, 158, 171, 0.12);
}

.agentes-pagination-btn--disabled {
  color: #c4cdd5;
  cursor: default;
}

.agentes-pagination-page.is-active {
  background: var(--geral-text);
  color: #fff;
}

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

@media (max-width: 768px) {
  .agentes-grid {
    grid-template-columns: 1fr;
  }

  .agent-card-stats {
    overflow-x: auto;
  }
}

/* --- Perfil do agente --- */

.agent-profile-page {
  max-width: 1200px;
}

.agent-profile-header {
  position: relative;
  margin-bottom: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.agent-profile-cover-wrap {
  position: relative;
}

.agent-profile-cover {
  height: 220px;
  background-size: cover;
  background-position: center;
}

.agent-profile-cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 24px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.55) 100%);
}

.agent-profile-identity {
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.agent-profile-avatar-wrap {
  flex-shrink: 0;
}

.agent-profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid #fff;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.agent-profile-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2065d1 0%, #103996 100%);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
}

.agent-profile-cover-text {
  padding-bottom: 4px;
}

.agent-profile-name {
  margin: 0 0 4px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.agent-profile-role {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9375rem;
}

.agent-profile-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 24px;
  border-top: 1px solid var(--geral-border);
  background: #fff;
}

.agent-profile-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--geral-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}

.agent-profile-tab:hover {
  color: var(--geral-text);
}

.agent-profile-tab.is-active {
  color: var(--geral-text);
  border-bottom-color: var(--geral-text);
}

.agent-profile-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--geral-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-profile-tab-panel {
  display: block;
}

.agent-profile-tab-panel[hidden] {
  display: none;
}

.agent-profile-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.agent-profile-sidebar,
.agent-profile-chat,
.agent-steps {
  padding: 24px;
}

.agent-profile-controls {
  justify-content: flex-start;
  margin-bottom: 20px;
}

.agent-profile-meta {
  margin: 0 0 20px;
}

.agent-profile-meta-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--geral-border);
}

.agent-profile-meta-item:last-child {
  border-bottom: none;
}

.agent-profile-meta dt {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--geral-muted);
}

.agent-profile-meta dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.agent-profile-about {
  margin-bottom: 20px;
}

.agent-profile-about-title {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 700;
}

.agent-profile-about p {
  margin: 0;
  color: var(--geral-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.agent-profile-sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-profile-chat-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-profile-message-input {
  min-height: 140px;
  resize: vertical;
}

.agent-profile-chat-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.agent-profile-chat-hint {
  font-size: 0.8125rem;
  color: var(--geral-muted);
}

.agent-profile-log-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 480px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--geral-border);
  overflow-y: auto;
}

.agent-profile-log-empty {
  margin: 0;
  color: var(--geral-muted);
  text-align: center;
  padding: 24px 0;
}

.agent-steps-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.agent-steps-subtitle {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--geral-muted);
}

.agent-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-steps-empty {
  margin: 0;
  padding: 32px 16px;
  text-align: center;
  color: var(--geral-muted);
  border: 1px dashed var(--geral-border);
  border-radius: 12px;
}

.agent-step-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--geral-border);
  border-radius: 12px;
  background: #f8fafc;
}

.agent-step-order {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--geral-border);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--geral-text);
}

.agent-step-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.agent-step-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--geral-muted);
  line-height: 1.5;
}

.agent-step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge-step-type {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent-step-config-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--geral-muted);
  word-break: break-all;
}

.agent-step-script-preview {
  display: inline;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  background: rgba(145, 158, 171, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.agent-step-script-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.agent-step-type-fields[hidden] {
  display: none;
}

.agent-screen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.agent-screen-subtitle {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--geral-muted);
}

.agent-screen-status {
  flex-shrink: 0;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid var(--geral-border);
  font-size: 0.8125rem;
  color: var(--geral-text);
}

.agent-screen-status.is-success {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.agent-screen-status.is-error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.agent-screen-status.is-loading {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.agent-screen-frame-wrap {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--geral-border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
}

.agent-screen-iframe {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
  background: #fff;
}

.agent-screen-iframe.is-active {
  min-height: 640px;
}

.agent-screen-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9375rem;
  background: #0f172a;
}

.agent-screen-placeholder[hidden] {
  display: none;
}

.agent-log-entry {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.agent-log-entry-avatar-wrap {
  flex-shrink: 0;
}

.agent-log-entry-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.agent-log-entry-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dfe3e8;
  color: #637381;
  font-size: 0.8125rem;
  font-weight: 700;
}

.agent-log-entry-content {
  flex: 1;
  min-width: 0;
  padding: 16px;
  border-radius: 12px;
  background: #f4f6f8;
}

.agent-log-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.agent-log-entry-author {
  font-size: 0.875rem;
  font-weight: 700;
  color: #212b36;
}

.agent-log-entry-date {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: #919eab;
}

.agent-log-entry-message {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #637381;
  word-break: break-word;
}

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

@media (max-width: 1024px) {
  .agent-profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .agent-profile-cover-overlay {
    padding: 0 16px 16px;
  }

  .agent-profile-identity {
    flex-direction: column;
    align-items: flex-start;
  }

  .agent-profile-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 16px;
  }

  .agent-profile-chat-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .agent-steps-header {
    flex-direction: column;
    align-items: stretch;
  }

  .agent-step-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .agent-step-actions {
    justify-content: flex-start;
  }

  .agent-screen-header {
    flex-direction: column;
    align-items: stretch;
  }

  .agent-screen-status {
    max-width: none;
  }

  .agent-screen-frame-wrap,
  .agent-screen-iframe {
    min-height: 420px;
  }
}