/* [Fase 30.1] Space Grotesk for the Flow360 brand label only.
   The rest of the app keeps the existing system font stack. */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&display=swap");

html {
  color: var(--color-text-dark);
  overflow: hidden;
  font-size: var(--font-size);
  font-family: var(--font-family);
  height: 100%;
  line-height: normal !important;
}

html.dragging * {
  user-select: none;
  pointer-events: none;
}

pre.prettyprint {
  text-wrap: wrap;
  word-break: break-word;
}

body {
  height: 100%;
}

/* inline attachment pills */
.attachment {
  display: flex;
  margin-right: 5px;
  font-size: 0;
  white-space: nowrap;
}

.attachment .attachment-preview {
  background-color: #eaeaea;
  border: 0;
  color: #777;
  display: flex;
  font-size: 12px;
  height: 18px;
  padding: 3px 8px;
  text-decoration: none;
  overflow: hidden;
}

.attachment .attachment-download {
  background-color: #e0e0e0;
  border: 0;
  color: #666;
  display: inline-block;
  font-size: 12px;
  padding: 3px;
}

.ReactModalPortal p {
  margin-block-end: 14px;
  margin-block-start: 10px;
  margin-inline-end: 0px;
  margin-inline-start: 0px;
}

.hide {
  display: none;
}

temba-menu > div {
  display: none;
}

.shadow {
  --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 40px 0 rgba(0, 0, 0, 0.09);
}

temba-modax,
temba-dialog {
  --button-y: 0.5em;
}

temba-button {
  --button-shadow: 0 0px 0px 1px rgba(0, 0, 0, 0.02),
    0 1px 9px 0 rgba(0, 0, 0, 0.2);
}

temba-button.light {
  --button-shadow: rgba(0, 0, 0, 0.05) 0px 3px 7px 0px,
    rgba(0, 0, 0, 0.07) 0px 1px 1px 1px;
}

temba-button {
  --button-bg: var(--color-primary-dark);
  --button-text: var(--color-text-light);
  --button-border: none;
  --button-shadow: var(--widget-box-shadow);
}

temba-button:hover {
  --button-bg-img: linear-gradient(
    to bottom,
    rgba(var(--primary-rgb), 0.1),
    transparent,
    transparent
  );
}

temba-button.active {
  --button-bg-img: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.05));
}

temba-button.light {
  --button-bg: #fff;
  --button-text: #999;
  --button-border: none;
  --button-shadow: var(--widget-box-shadow);
}

temba-button.light:hover {
  --button-bg-img: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 0, 0, 0.001)
  );
}

temba-button.light.active {
  --button-bg-img: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.02));
}

temba-select:focus {
  outline: none;
  box-shadow: none;
}

temba-dropdown {
  opacity: 0;
}

temba-dropdown:defined {
  opacity: 1;
}

temba-menu {
  display: none;
}

temba-menu:defined {
  display: block;
}

.list-buttons-container {
  --icon-color: #666;
  margin-left: 1em;
}

.list-buttons-container.visible {
}

.spa-container {
  background: #f7f7f7;
  overflow-y: clip;
  overflow-x: auto;
}

.spa-container.loading .spa-content {
  opacity: 0.3;
  pointer-events: none;
}

.widget-container.loading .spa-loader,
.spa-container.loading .spa-loader {
  display: block;
}

.widget-container.loading .folders,
.widget-container.loading .spa-content,
.widget-container.loading .org-chooser {
  opacity: 0.3;
  pointer-events: none;
}

.org-chooser {
  background: rgba(0, 0, 0, 0.02);
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.1) inset;
  color: rgba(0, 0, 0, 0.6);
  --color-widget-border: transparent;
  --color-widget-bg: transparent;
  --temba-select-selected-padding: 0em;
  --color-widget-bg-focused: transparent;
  --color-focus: transparent;
  --widget-box-shadow-focused: transparent;
}

temba-loading {
  z-index: 1000;
}

.title-text {
  transition: opacity 100ms linear;
}

.loading .title-text {
  opacity: 0;
}

.spa-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  transition: opacity 200ms linear;
}

.bg-gradient {
  background-repeat: no-repeat;
  background-image: linear-gradient(
    rgb(255, 255, 255) 0%,
    rgb(236, 236, 236) 75%
  );
}

.lp-frame .lp-nav-item {
  padding: 5px 10px !important;
  border-radius: var(--curvature);
}

.lp-frame .lp-nav-item.selected {
  background: var(--color-selection);
  color: var(--color-primary-dark) !important;
}

.lp-frame {
  margin-top: 0px;
  padding-top: 0em;
  padding-right: 0em;
  padding-left: 0em;
  flex-grow: 1;
  overflow-y: auto;
}

.lp-frame .left {
  padding-top: 1em;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 1em;
  padding-left: 0.1em;
  margin-right: 0em;
  width: 18em;
  padding-bottom: 1em;
}

.lp-frame .right {
  padding: 0em;
  margin: 0em;
}

.lp-frame .left .lp-nav .inner-scroll {
  overflow: inherit;
  height: inherit;
  max-height: inherit;
}

.object-list {
  -webkit-transform: translate3d(0, 0, 0);
}

.button-action {
  background: #fff;
}

#gear-container .button-light {
  padding-top: 0.62em;
  padding-bottom: 0.62em;
  margin-top: 4px;
  background: #fff;
}

#gear-container .button-light.dropdown-toggle {
  padding-top: 0.58em;
  padding-bottom: 0.58em;
  margin-top: 4px;
  background: #fff;
}

.spa-container {
  height: 100%;
}

table.list.selectable tbody tr:hover td {
  background-color: var(--color-row-hover);
  cursor: pointer;
}

.page-title {
  font-size: 1.5em;
}

temba-menu {
  background: #fff;
  border-right: 1px solid #eee;
}

temba-menu.servicing {
  --primary-rgb: 191, 84, 155;
  --color-primary-dark: rgb(var(--primary-rgb));
  --color-selection: rgba(var(--primary-rgb), 0.05);
}

.formax .formax-section.open {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.servicing:hover .hover {
  background: rgba(0, 0, 0, 0.2);
}

.spa-content {
  overflow-y: auto;
  overflow-x: hidden;
}

.input {
  border-radius: var(--curvature-widget);
  cursor: text;
  background: var(--color-widget-bg);
  border: 1px solid var(--color-widget-border);
  transition: all ease-in-out 200ms;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  box-shadow: var(--widget-box-shadow);
  caret-color: var(--input-caret);
  padding: var(--temba-textinput-padding);
}

.input:focus {
  outline: none;
  border-color: var(--color-focus);
  background: var(--color-widget-bg-focused);
  box-shadow: var(--widget-box-shadow-focused);
}

#error-dialog {
  display: none;
}

/* ------------------------------------------------------------------
 * [Fase 33.x — revert] Volvemos a la configuración stock de RapidPro
 * (sidebar azul con iconos blancos). Las customizations Flow360 de
 * Fase 30.1 (light theme) y 33.x (dark theme + variants) generaban
 * más bugs visuales (bloques blancos, hover flashes, divider issues)
 * que valor de marca. Por ahora dejamos el look original y volvemos
 * a la identidad visual cuando tengamos tiempo de hacerlo bien.
 *
 * Solo mantenemos el label "Flow360" arriba del sidebar como marca
 * mínima — no requiere overrides de tema porque hereda el bg azul
 * stock y usa texto blanco que se lee bien sobre azul.
 * ------------------------------------------------------------------ */

.flow360-brand {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: #111827;
  text-align: left;
  padding: 0.85rem 0.5rem 0.6rem 0.85rem;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  user-select: none;
}

.flow360-sidebar {
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------
 * [Fase 36.2 — rapidpro-custom] Topbar global
 *
 * Barra fija arriba con brand + workspace + search + notifications +
 * avatar. Skeleton visual (paso 1) — la lógica interactiva (workspace
 * switcher dropdown, search backend, notifications panel, avatar
 * menu) llega en los pasos 2-5 de la sub-fase.
 *
 * Reusa la tipografía del brand existente (Space Grotesk weight 700)
 * y la paleta del frame (#111827 texto, #e5e7eb bordes, #f3f4f6
 * hover bg).
 * ------------------------------------------------------------------ */

.flow360-topbar {
  display: flex;
  align-items: center;
  height: 56px;
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1rem;
  gap: 1rem;
  z-index: 10;
}

.flow360-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.flow360-topbar-brand {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: #111827;
  user-select: none;
  padding-right: 0.75rem;
  border-right: 1px solid #e5e7eb;
  line-height: 1;
}

.flow360-topbar-workspace-wrapper {
  position: relative;
}

.flow360-topbar-workspace {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  padding: 0.4rem 0.65rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.12s ease;
  user-select: none;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow360-topbar-workspace:hover {
  background: #f3f4f6;
}

.flow360-topbar-caret {
  font-size: 0.7rem;
  color: #9ca3af;
}

/* [Fase 36.2.2] Workspace switcher dropdown */
.flow360-topbar-workspace-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-width: 320px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 100;
  overflow: hidden;
  animation: flow360TopbarDropdownIn 0.14s ease-out;
}

@keyframes flow360TopbarDropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.flow360-topbar-workspace-dropdown-header {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem 0.4rem;
  border-bottom: 1px solid #f3f4f6;
}

.flow360-topbar-workspace-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.flow360-topbar-workspace-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.1s ease;
  user-select: none;
}

.flow360-topbar-workspace-item:hover {
  background: #f3f4f6;
}

.flow360-topbar-workspace-item.is-current {
  cursor: default;
  font-weight: 500;
  color: #111827;
  background: #f9fafb;
}

.flow360-topbar-workspace-item.is-current:hover {
  background: #f9fafb;
}

.flow360-topbar-workspace-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow360-topbar-workspace-item-check {
  color: #10b981;
  font-weight: 700;
  flex-shrink: 0;
}

.flow360-topbar-workspace-loading,
.flow360-topbar-workspace-empty {
  padding: 0.85rem;
  text-align: center;
  font-size: 0.825rem;
  color: #9ca3af;
  font-style: italic;
}

.flow360-topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.flow360-topbar-search {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 520px;
  background: #f3f4f6;
  border-radius: 0.5rem;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
  transition: background-color 0.12s ease;
}

.flow360-topbar-search:hover {
  background: #e5e7eb;
}

.flow360-topbar-search-icon {
  font-size: 0.95rem;
  opacity: 0.6;
  user-select: none;
}

.flow360-topbar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.875rem;
  color: #374151;
  min-width: 0;
}

.flow360-topbar-search input::placeholder {
  color: #9ca3af;
  font-style: italic;
}

.flow360-topbar-search input:disabled {
  cursor: not-allowed;
}

.flow360-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.flow360-topbar-notif-wrapper {
  position: relative;
}

.flow360-topbar-notif {
  position: relative;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 0.375rem;
  line-height: 1;
  transition: background-color 0.12s ease;
  user-select: none;
}

.flow360-topbar-notif:hover {
  background: #f3f4f6;
}

/* [Fase 36.2.3] Badge rojo del bell — proporcional al emoji */
.flow360-topbar-notif-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  background: #ef4444;
  color: #ffffff;
  border-radius: 7px;
  font-size: 0.58rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 1.5px #ffffff;
}

/* [Fase 36.2.3] Notifications dropdown */
.flow360-topbar-notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: 90vw;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 100;
  overflow: hidden;
  animation: flow360TopbarDropdownIn 0.14s ease-out;
}

.flow360-topbar-notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
}

.flow360-topbar-notif-mark-read {
  font-size: 0.72rem;
  font-weight: 500;
  color: #6366f1;
  text-decoration: none;
  cursor: pointer;
}

.flow360-topbar-notif-mark-read:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.flow360-topbar-notif-list {
  max-height: 380px;
  overflow-y: auto;
}

.flow360-topbar-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.95rem;
  text-decoration: none;
  color: #374151;
  border-bottom: 1px solid #f9fafb;
  transition: background-color 0.1s ease;
}

.flow360-topbar-notif-item:last-child {
  border-bottom: none;
}

.flow360-topbar-notif-item:hover {
  background: #f9fafb;
  text-decoration: none;
}

.flow360-topbar-notif-item.is-unseen {
  background: #eff6ff;
}

.flow360-topbar-notif-item.is-unseen:hover {
  background: #dbeafe;
}

.flow360-topbar-notif-item-icon {
  font-size: 1.15rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.flow360-topbar-notif-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.flow360-topbar-notif-item-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow360-topbar-notif-item.is-unseen .flow360-topbar-notif-item-label {
  font-weight: 600;
}

.flow360-topbar-notif-item-time {
  font-size: 0.72rem;
  color: #9ca3af;
}

.flow360-topbar-notif-loading,
.flow360-topbar-notif-empty {
  padding: 1.5rem 0.95rem;
  text-align: center;
  font-size: 0.85rem;
  color: #9ca3af;
  font-style: italic;
}

.flow360-topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.flow360-topbar-avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* [Fase 36.2.4] Avatar dropdown menu */
.flow360-topbar-avatar-wrapper {
  position: relative;
}

.flow360-topbar-avatar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 100;
  overflow: hidden;
  animation: flow360TopbarDropdownIn 0.14s ease-out;
}

.flow360-topbar-avatar-dropdown-header {
  padding: 0.85rem 0.95rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

.flow360-topbar-avatar-dropdown-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow360-topbar-avatar-dropdown-email {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow360-topbar-avatar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.95rem;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.1s ease;
}

.flow360-topbar-avatar-dropdown-item:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

.flow360-topbar-avatar-dropdown-item-danger {
  color: #dc2626;
}

.flow360-topbar-avatar-dropdown-item-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.flow360-topbar-avatar-dropdown-icon {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.flow360-topbar-avatar-dropdown-separator {
  height: 1px;
  background: #f3f4f6;
  margin: 0.25rem 0;
}
