:root {
  color-scheme: light;
  font-family: "Segoe UI", "Segoe UI Variable", system-ui, sans-serif;
  --ec-bg: #f3f3f3;
  --ec-bg-elevated: #fcfcfc;
  --ec-bg-soft: #ebebeb;
  --ec-text: #1f1f1f;
  --ec-text-muted: #616161;
  --ec-border: #ececec;
  --ec-border-strong: #e0e0e0;
  --ec-accent: #0e639c;
  --ec-accent-soft: #e8f2fa;
  --ec-danger-bg: #fde7e9;
  --ec-danger-text: #a4262c;
  --ec-terminal-bg: #f3f3f3;
  --ec-terminal-header: #ebebeb;
  --ec-terminal-text: #1f1f1f;
  --ec-terminal-input: #ffffff;
  --ec-preview-bg: #f3f3f3;
  --ec-shadow: rgba(0, 0, 0, 0.08);
  --ec-statusbar-bg: #f3f3f3;
  --ec-statusbar-text: #1f1f1f;
  --ec-statusbar-border: #e5e5e5;
  --ec-hover: rgba(0, 0, 0, 0.04);
  --ec-chat-user-bg: rgba(14, 99, 156, 0.08);
  --ec-chat-assistant-bg: rgba(0, 0, 0, 0.035);
  --ec-chat-border: rgba(0, 0, 0, 0.06);
  --ec-titlebar-bg: #fcfcfc;
  --ec-titlebar-fg: #1f1f1f;
  color: var(--ec-text);
  background: var(--ec-bg);
}

html[data-theme="blanco"],
html[data-theme=""] {
  color-scheme: light;
  --ec-preview-bg: #f3f3f3;
}

/* Cursor-like charcoal */
html[data-theme="gris"] {
  color-scheme: dark;
  --ec-bg: #1e1e1e;
  --ec-bg-elevated: #181818;
  --ec-bg-soft: #252526;
  --ec-text: #cccccc;
  --ec-text-muted: #9d9d9d;
  --ec-border: #2a2a2a;
  --ec-border-strong: #333333;
  --ec-accent: #3794ff;
  --ec-accent-soft: #1a2a3a;
  --ec-danger-bg: #5a1d1d;
  --ec-danger-text: #f48771;
  --ec-terminal-bg: #1e1e1e;
  --ec-terminal-header: #252526;
  --ec-terminal-text: #cccccc;
  --ec-terminal-input: #141414;
  --ec-preview-bg: #1e1e1e;
  --ec-shadow: rgba(0, 0, 0, 0.45);
  --ec-statusbar-bg: #181818;
  --ec-statusbar-text: #cccccc;
  --ec-statusbar-border: #2b2b2b;
  --ec-hover: rgba(255, 255, 255, 0.06);
  --ec-chat-user-bg: rgba(55, 148, 255, 0.09);
  --ec-chat-assistant-bg: rgba(255, 255, 255, 0.045);
  --ec-chat-border: rgba(255, 255, 255, 0.07);
  --ec-titlebar-bg: #181818;
  --ec-titlebar-fg: #cccccc;
}

/* Negro profundo (casi Cursor dark+) */
html[data-theme="negro"] {
  color-scheme: dark;
  --ec-bg: #0d0d0d;
  --ec-bg-elevated: #141414;
  --ec-bg-soft: #1a1a1a;
  --ec-text: #d4d4d4;
  --ec-text-muted: #8a8a8a;
  --ec-border: #1f1f1f;
  --ec-border-strong: #2a2a2a;
  --ec-accent: #4fc1ff;
  --ec-accent-soft: #123040;
  --ec-danger-bg: #3a1717;
  --ec-danger-text: #f48771;
  --ec-terminal-bg: #0d0d0d;
  --ec-terminal-header: #141414;
  --ec-terminal-text: #d4d4d4;
  --ec-terminal-input: #0a0a0a;
  --ec-preview-bg: #0d0d0d;
  --ec-shadow: rgba(0, 0, 0, 0.55);
  --ec-statusbar-bg: #141414;
  --ec-statusbar-text: #d4d4d4;
  --ec-statusbar-border: #252525;
  --ec-hover: rgba(255, 255, 255, 0.05);
  --ec-chat-user-bg: rgba(79, 193, 255, 0.08);
  --ec-chat-assistant-bg: rgba(255, 255, 255, 0.04);
  --ec-chat-border: rgba(255, 255, 255, 0.06);
  --ec-titlebar-bg: #141414;
  --ec-titlebar-fg: #d4d4d4;
}

/* Azul slate (menos saturado, más IDE) */
html[data-theme="azul"] {
  color-scheme: dark;
  --ec-bg: #0f1720;
  --ec-bg-elevated: #15202b;
  --ec-bg-soft: #1a2734;
  --ec-text: #d7e2ec;
  --ec-text-muted: #8fa3b5;
  --ec-border: #1e2a36;
  --ec-border-strong: #2a3848;
  --ec-accent: #5b9fd4;
  --ec-accent-soft: #1a3348;
  --ec-danger-bg: #3a1a28;
  --ec-danger-text: #f0a0b0;
  --ec-terminal-bg: #0f1720;
  --ec-terminal-header: #15202b;
  --ec-terminal-text: #d7e2ec;
  --ec-terminal-input: #0c1218;
  --ec-preview-bg: #0f1720;
  --ec-shadow: rgba(0, 0, 0, 0.4);
  --ec-statusbar-bg: #15202b;
  --ec-statusbar-text: #d7e2ec;
  --ec-statusbar-border: #243140;
  --ec-hover: rgba(91, 159, 212, 0.12);
  --ec-chat-user-bg: rgba(91, 159, 212, 0.09);
  --ec-chat-assistant-bg: rgba(255, 255, 255, 0.045);
  --ec-chat-border: rgba(255, 255, 255, 0.07);
  --ec-titlebar-bg: #15202b;
  --ec-titlebar-fg: #d7e2ec;
}

* { box-sizing: border-box; }

:root, html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  grid-template-rows: 36px 1fr 22px;
  grid-template-columns: minmax(400px, var(--chat-width, 0.85fr)) 10px minmax(280px, var(--browser-width, 1.25fr)) 10px minmax(260px, 0.95fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--ec-bg);
  color: var(--ec-text);
}

/* Línea fina continua bajo el titlebar (no la tapa el overlay de min/max/cerrar) */
body > main,
body > .viewer,
body > .files,
body > .splitter {
  border-top: 1px solid var(--ec-border);
}

body.projects-collapsed {
  grid-template-columns: minmax(400px, var(--chat-width, 0.85fr)) 10px minmax(280px, var(--browser-width, 1.35fr)) 0 0;
}

body.welcome-open {
  grid-template-rows: 36px 1fr 22px;
}

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

/* ── toolbar (una sola, slim; título OS fusionado vía titleBarOverlay) ── */
.app-toolbar {
  grid-column: 1 / -1;
  grid-row: 1;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 138px 0 8px; /* espacio para botones nativos de ventana */
  /* Sin border-bottom: el overlay nativo tapa la esquina y “corta” la línea.
     La regla continua vive en el borde superior del contenido (y=36). */
  border-bottom: 0;
  background: var(--ec-titlebar-bg);
  color: var(--ec-titlebar-fg, var(--ec-text));
  overflow: visible;
  z-index: 100;
  -webkit-app-region: drag;
  app-region: drag;
}
.app-toolbar .toolbar-nav,
.app-toolbar button,
.app-toolbar a,
.app-toolbar input,
.app-toolbar select,
.app-toolbar .toolbar-more-wrap {
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
.toolbar-brand-wrap {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-right: 6px;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
.toolbar-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
}
.toolbar-brand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ec-text);
  line-height: 1;
  white-space: nowrap;
}
.toolbar-nav {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
  scrollbar-width: thin;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  overflow: visible;
}
.toolbar-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 14px;
  margin: 0 6px;
  background: var(--ec-border);
}
.app-toolbar button {
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ec-text) !important;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none !important;
  vertical-align: middle;
  transition: color 100ms ease, background 100ms ease;
}
.app-toolbar button:hover {
  background: var(--ec-hover) !important;
  color: var(--ec-text) !important;
}
.app-toolbar button:focus-visible {
  outline: 1px solid var(--ec-accent);
  outline-offset: 1px;
}
.app-toolbar .toolbar-connect-btn,
.app-toolbar .toolbar-publish-btn {
  margin-left: 2px;
  padding: 0 8px;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--ec-accent) !important;
  font-weight: 600;
  background: transparent !important;
  box-shadow: none !important;
}
.app-toolbar .toolbar-admin-btn {
  color: #d97706 !important;
  font-weight: 600;
}
.app-toolbar .toolbar-admin-btn[hidden] {
  display: none !important;
}
.app-toolbar .toolbar-settings-btn {
  margin-left: auto;
  font-size: 15px;
  padding: 0 8px;
  -webkit-app-region: no-drag;
}
.app-toolbar .toolbar-connect-btn:hover,
.app-toolbar .toolbar-publish-btn:hover {
  background: var(--ec-hover) !important;
  color: var(--ec-accent) !important;
  filter: none;
  text-decoration: none;
}
.app-toolbar button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.app-toolbar #chatThreadSelect {
  display: none !important;
}
.chat-tabs-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px 0;
  border-bottom: 1px solid var(--ec-border);
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  overflow: hidden;
}
.chat-tabs-bar .agent-specialist-badge {
  margin-bottom: 6px;
}
.chat-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: thin;
}
.chat-tab {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 220px;
  height: 30px;
  padding: 0 2px 0 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--ec-text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 1 auto;
}
.chat-tab:hover {
  background: var(--ec-bg-soft);
  color: var(--ec-text);
}
.chat-tab.is-active {
  background: var(--ec-bg);
  color: var(--ec-text);
  border-color: var(--ec-border);
}
.chat-tab-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 4px;
}
.chat-tab-close,
.chat-tab-new,
.chat-tab-trash,
.chat-tab-reload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6a7785;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}
.chat-tab-close:hover,
.chat-tab-new:hover,
.chat-tab-trash:hover,
.chat-tab-reload:hover {
  background: #e8eef2;
  color: #17202a;
}
.chat-tab-new {
  font-size: 18px;
  font-weight: 500;
}
.chat-tab-trash {
  font-size: 13px;
  font-weight: 700;
}
.chat-tab-reload {
  font-size: 13px;
}
.chat-tab-reload:hover svg {
  transform: rotate(180deg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.composer-reload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--ec-border, #dbe2e6);
  border-radius: 6px;
  background: var(--ec-bg, #ffffff);
  color: var(--ec-text-muted, #6a7785);
  cursor: pointer;
  transition: all 0.2s ease;
}
.composer-reload-btn:hover {
  background: var(--ec-bg-soft, #f0f4f8);
  color: var(--ec-text, #17202a);
  border-color: var(--ec-border-strong, #b8c4ce);
}
.composer-reload-btn:hover svg {
  transform: rotate(180deg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toolbar-more-wrap {
  position: relative;
  flex: 0 0 auto;
  overflow: visible;
  z-index: 110;
}
.toolbar-more-btn {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 8px !important;
  height: 28px !important;
  background: transparent !important;
  color: var(--ec-text) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
.toolbar-more-btn:hover {
  background: var(--ec-hover) !important;
  color: var(--ec-text) !important;
}
.toolbar-more-menu {
  position: fixed;
  top: 48px;
  left: 0;
  z-index: 10000;
  min-width: 220px;
  max-height: min(70vh, 420px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  box-shadow: 0 10px 28px var(--ec-shadow);
}
.toolbar-more-menu.hidden,
.toolbar-more-menu[hidden] {
  display: none !important;
}
.toolbar-more-menu button {
  height: 34px;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border-radius: 6px !important;
  padding: 0 10px !important;
  font-weight: 600 !important;
  color: var(--ec-text) !important;
}
.toolbar-more-menu button:hover {
  background: var(--ec-accent-soft) !important;
  color: var(--ec-accent) !important;
}

/* ── sidebar (proyectos/archivos) ── */
body.projects-collapsed aside { width: 0; padding: 0; border: 0; overflow: hidden; }

aside {
  grid-column: 5;
  grid-row: 2;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 6px;
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  border-left: 0;
  padding: 12px 10px;
  overflow: hidden;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  margin-bottom: 4px;
}

.brand-mark {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark img { width: 32px; height: 32px; flex: 0 0 auto; }

h1 { margin: 0; font-size: 15px; }

.brand-mark small {
  display: block;
  margin-top: 1px;
  color: #6c7a89;
  font-size: 10px;
  font-weight: 700;
}

.project-open-btn {
  height: auto;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ec-accent, #1b6f79);
  padding: 2px 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none !important;
  outline: none !important;
  transition: color 120ms, opacity 120ms, transform 80ms;
}
.project-open-btn:hover {
  color: var(--ec-accent);
  background: transparent !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.project-open-btn:active {
  transform: translateY(1px);
  opacity: 0.75;
}
.project-open-btn:disabled {
  opacity: 0.35;
  cursor: default;
  text-decoration: none;
}
.project-close-btn {
  border: 0 !important;
  color: var(--ec-text-muted);
}
.project-close-btn:hover:not(:disabled) {
  background: transparent !important;
  color: var(--ec-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--ec-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 8px;
}

.project-path-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ec-text-muted);
  font-size: 10px;
  margin-top: 2px;
  margin-bottom: 6px;
  line-height: 1.35;
}


.hidden { display: none !important; }

.file-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 2px 0;
  background: transparent;
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px 6px;
  border-bottom: 1px solid var(--ec-border);
  margin-bottom: 2px;
}

.file-list-crumbs {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--ec-text-muted);
}

.file-root-btn {
  flex: 0 0 auto;
  border: 0 !important;
  background: transparent !important;
  color: var(--ec-accent);
  border-radius: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 0;
  cursor: pointer;
}
.file-root-btn:hover {
  background: transparent !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-item {
  min-width: 0;
  min-height: 26px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  word-break: normal;
  line-height: 1.35;
  text-align: right;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ec-text);
  font-size: 12px;
  padding: 4px 8px 4px 8px;
  cursor: pointer;
  direction: ltr;
  position: relative;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.file-item-label {
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 16px);
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  order: 2;
}
.file-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.file-item-icon {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
}
.file-item-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  order: 1;
  margin-right: auto;
  background: #38bdf8;
  box-shadow:
    0 0 0 1.5px rgba(56, 189, 248, 0.35),
    0 0 8px rgba(56, 189, 248, 0.7);
  opacity: 1;
  display: inline-block;
}
.file-item-dot.is-idle {
  opacity: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  visibility: hidden;
}
html[data-theme="blanco"] .file-item-dot,
html[data-theme=""] .file-item-dot {
  background: #0284c7;
  box-shadow:
    0 0 0 1.5px rgba(2, 132, 199, 0.3),
    0 0 8px rgba(2, 132, 199, 0.6);
}
html[data-theme="blanco"] .file-item-dot.is-idle,
html[data-theme=""] .file-item-dot.is-idle {
  background: transparent;
  box-shadow: none;
  visibility: hidden;
}
.file-item:hover {
  background: var(--ec-hover);
  border: 0;
  color: var(--ec-text);
}
/* Bolita anclada a la izquierda del panel; nombre a la derecha; línea marca lateral visible */
.file-item.is-new,
.file-item.is-touched {
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.18) 0%,
    rgba(56, 189, 248, 0.06) 55%,
    transparent 100%
  ) !important;
  border: 0 !important;
  color: var(--ec-text) !important;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #38bdf8 !important;
}
html[data-theme="blanco"] .file-item.is-new,
html[data-theme="blanco"] .file-item.is-touched,
html[data-theme=""] .file-item.is-new,
html[data-theme=""] .file-item.is-touched {
  background: linear-gradient(
    90deg,
    rgba(2, 132, 199, 0.14) 0%,
    rgba(2, 132, 199, 0.05) 55%,
    transparent 100%
  ) !important;
  box-shadow: inset 3px 0 0 #0284c7 !important;
}
.file-item.is-writing {
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.28) 0%,
    rgba(56, 189, 248, 0.1) 55%,
    transparent 100%
  ) !important;
  border: 0 !important;
  color: var(--ec-text) !important;
  box-shadow: inset 3.5px 0 0 #38bdf8 !important;
  animation: file-touch-pulse 1.1s ease-in-out infinite;
}
html[data-theme="blanco"] .file-item.is-writing,
html[data-theme=""] .file-item.is-writing {
  background: linear-gradient(
    90deg,
    rgba(2, 132, 199, 0.22) 0%,
    rgba(2, 132, 199, 0.08) 55%,
    transparent 100%
  ) !important;
  box-shadow: inset 3.5px 0 0 #0284c7 !important;
}
.file-item-dot.is-writing-dot,
.file-item.is-writing .file-item-dot {
  background: #0284c7 !important;
  box-shadow: 0 0 0 2.5px rgba(2, 132, 199, 0.35), 0 0 10px rgba(2, 132, 199, 0.8) !important;
  animation: dot-pulse 0.9s ease-in-out infinite;
}
html[data-theme="negro"] .file-item-dot.is-writing-dot,
html[data-theme="gris"] .file-item-dot.is-writing-dot,
html[data-theme="azul"] .file-item-dot.is-writing-dot,
html[data-theme="negro"] .file-item.is-writing .file-item-dot,
html[data-theme="gris"] .file-item.is-writing .file-item-dot,
html[data-theme="azul"] .file-item.is-writing .file-item-dot {
  background: #38bdf8 !important;
  box-shadow: 0 0 0 2.5px rgba(56, 189, 248, 0.45), 0 0 12px rgba(56, 189, 248, 0.9) !important;
}
.file-item.directory.is-touched,
.file-item.directory.is-new {
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.14) 0%,
    rgba(56, 189, 248, 0.04) 60%,
    transparent 100%
  ) !important;
  border: 0 !important;
  color: var(--ec-text) !important;
  box-shadow: inset 3px 0 0 #38bdf8 !important;
}
html[data-theme="blanco"] .file-item.directory.is-touched,
html[data-theme="blanco"] .file-item.directory.is-new,
html[data-theme=""] .file-item.directory.is-touched,
html[data-theme=""] .file-item.directory.is-new {
  background: linear-gradient(
    90deg,
    rgba(2, 132, 199, 0.12) 0%,
    rgba(2, 132, 199, 0.04) 60%,
    transparent 100%
  ) !important;
  box-shadow: inset 3px 0 0 #0284c7 !important;
}
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.85; }
}
@keyframes file-touch-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.1); }
}
.file-item.directory { font-weight: 700; }

.file-ctx-menu {
  position: fixed;
  z-index: 12000;
  min-width: 196px;
  max-width: 280px;
  padding: 4px;
  margin: 0;
  list-style: none;
  border: 1px solid #c8dfdc;
  border-radius: 8px;
  background: #f7fcfb;
  box-shadow: 0 10px 28px rgba(15, 40, 45, 0.16);
  color: #17323a;
  font-size: 12px;
}

.file-ctx-menu[hidden] {
  display: none !important;
}

.file-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 5px;
  padding: 7px 10px;
  cursor: pointer;
  font: inherit;
}

.file-ctx-item:hover,
.file-ctx-item:focus-visible {
  background: #e5f4f2;
  color: #0f6b63;
  outline: none;
}

.file-ctx-item.is-danger {
  color: #a12828;
}

.file-ctx-item.is-danger:hover,
.file-ctx-item.is-danger:focus-visible {
  background: #fdecec;
  color: #8a1c1c;
}

.file-ctx-sep {
  height: 1px;
  margin: 4px 6px;
  background: #d7e6e3;
  border: 0;
}

.file-empty { color: var(--ec-text-muted); font-size: 11px; padding: 6px; }

.agent-code-fragment {
  margin: 6px 0 8px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #0f1720;
  color: #e8eef5;
  overflow: hidden;
  font-size: 11.5px;
}
.agent-code-fragment-head {
  padding: 6px 10px;
  background: #1b2733;
  color: #f0c674;
  font-weight: 600;
  border-bottom: 1px solid #2a3848;
  word-break: break-all;
}
.agent-code-fragment-body {
  margin: 0;
  padding: 8px 10px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.4;
}
.agent-code-fragment-body .frag-old {
  color: #f8a0a0;
  display: block;
  opacity: 0.92;
}
.agent-code-fragment-body .frag-new {
  color: #9be59b;
  display: block;
}
.agent-code-fragment-body .frag-sep {
  color: #7f8c9a;
  display: block;
  margin: 4px 0;
}

/* ── Cursor-like Agent Execution Card ── */
.agent-execution-card .agent-execution-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  border-top: none;
  padding-top: 10px;
}

.agent-thought-accordion {
  border: 1px solid color-mix(in srgb, var(--ec-border) 80%, transparent);
  border-radius: 10px;
  /* Difuminado acorde al theme (no sólido blanco) */
  background: color-mix(in srgb, var(--ec-bg-elevated) 52%, transparent);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ec-text) 8%, transparent);
  overflow: hidden;
}
.agent-thought-accordion.is-empty,
.agent-thought-accordion[hidden] {
  display: none !important;
}
.agent-thought-summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ec-text-muted);
  user-select: none;
}
.agent-thought-summary::-webkit-details-marker { display: none; }
.agent-thought-summary::before {
  content: "▾ ";
  color: var(--ec-text-muted);
}
.agent-thought-accordion:not([open]) .agent-thought-summary::before { content: "▸ "; }
.agent-thought-stream,
.agent-live-stream {
  padding: 0 12px 12px;
  max-height: 280px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ec-text);
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-thought-line {
  margin: 0 0 6px;
}
.agent-thought-line.is-action { color: var(--ec-text); font-size: 12px; }
.agent-thought-line.is-meta { color: var(--ec-text-muted); font-size: 12px; font-style: italic; }
.agent-thought-line.is-stream { color: var(--ec-text); }

.agent-explore-block { margin: 2px 0; }
.agent-explore-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--ec-border) 85%, transparent);
  background: color-mix(in srgb, var(--ec-bg-elevated) 55%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ec-text);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.agent-explore-pill:hover,
.agent-explore-pill.is-open {
  border-color: var(--ec-border-strong);
  background: color-mix(in srgb, var(--ec-bg-soft) 65%, transparent);
}
.agent-explore-list {
  margin: 8px 0 0;
  padding: 8px 12px;
  list-style: none;
  border: 1px solid color-mix(in srgb, var(--ec-border) 85%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ec-bg-elevated) 55%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-height: 180px;
  overflow: auto;
}
.agent-explore-list li {
  font-size: 12px;
  color: var(--ec-text-muted);
  padding: 3px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.agent-inline-diffs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agent-inline-diff-card {
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
  color: #e2e8f0;
}
.agent-inline-diff-card.is-applied {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}
.agent-inline-diff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
  font-size: 12px;
}
.agent-inline-diff-path {
  font-weight: 600;
  color: #f8fafc;
  word-break: break-all;
}
.agent-inline-diff-deltas {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.agent-inline-diff-deltas .is-add { color: #4ade80; margin-right: 6px; }
.agent-inline-diff-deltas .is-del { color: #f87171; }
.agent-inline-diff-body {
  margin: 0;
  padding: 8px 0;
  max-height: 260px;
  overflow: auto;
  font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.agent-diff-line {
  padding: 0 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-diff-line.is-add {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}
.agent-diff-line.is-del {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}
.agent-diff-line.is-hunk {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.08);
}

.agent-activity-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-turn-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--ec-border, #e2e8f0);
}
.agent-turn-footer[hidden] {
  display: none !important;
}
.agent-footer-link {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  padding: 0;
  margin: 0;
  height: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--ec-text-muted, #64748b);
  cursor: pointer;
}
.agent-footer-link:hover {
  color: var(--ec-accent, #1b6f79);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: transparent !important;
}
.agent-footer-link:disabled {
  opacity: 0.45;
  cursor: default;
  text-decoration: none;
}
/* Legacy dual-button UI (Review/Stop/Done + follow-up): kill completely */
.agent-footer-btn,
.agent-footer-stop,
.agent-followup-input {
  display: none !important;
}
.agent-execution-done .agent-thought-accordion {
  background: color-mix(in srgb, var(--ec-bg-soft) 58%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}
.agent-final-response {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ec-text);
}
.agent-final-response p { margin: 0 0 14px; line-height: 1.55; }
.agent-final-response p:last-child { margin-bottom: 0; }

/* ── main (chat) ── */
main {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  background: var(--ec-bg);
  color: var(--ec-text);
  overflow: hidden;
}

/* Topbar de chat eliminada — el estado vive en .app-statusbar */
.topbar {
  display: none !important;
}

.chat-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--ec-accent);
}

/* El progreso util vive dentro del mensaje activo; la franja tecnica superior
   y la cola de ejecucion no se muestran al usuario. */
.topbar,
.prompt-queue {
  display: none !important;
}

.prompt-queue {
  display: grid;
  gap: 5px;
  padding: 8px 12px;
  border-bottom: 1px solid #dde2e8;
  background: #ffffff;
}

.queue-chip {
  min-height: 26px;
  display: flex;
  align-items: center;
  border: 1px solid #d6e3e4;
  border-radius: 6px;
  background: #f4faf9;
  color: #174f57;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  gap: 8px;
  overflow: hidden;
}

.queue-chip-label { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-chip-actions { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.queue-chip-actions button { height: 22px; border: 1px solid #bdd2d4; border-radius: 5px; background: #fff; color: #174f57; padding: 0 7px; font-size: 10px; font-weight: 800; cursor: pointer; }
.queue-chip-actions button:hover { border-color: #1b6f79; background: #e5f3f2; }
.queue-chip-actions button:last-child { width: 22px; padding: 0; font-size: 14px; }

.queue-chip.running {
  border-color: #1b6f79;
  background: #edf7f6;
  color: #123f45;
}

.chat-title {
  min-width: 0;
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
}

.chat-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.chat-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #6c7a89;
}

/* ── feed ── */
.feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, color-mix(in srgb, var(--ec-accent) 6%, transparent), transparent 60%),
    var(--ec-bg);
}

.msg {
  width: 100%;
  min-width: 0;
  max-width: 820px;
  padding: 10px 12px;
  background: var(--ec-chat-assistant-bg) !important;
  border: 1px solid var(--ec-chat-border) !important;
  border-radius: 12px !important;
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  box-shadow: none;
  white-space: pre-wrap;
  word-break: break-word;
  align-self: flex-start;
}

.msg.user {
  width: auto;
  align-self: flex-end;
  margin-left: auto;
  max-width: 76%;
  padding: 10px 14px;
  border-radius: 12px !important;
  background: var(--ec-chat-user-bg) !important;
  border: 1px solid var(--ec-chat-border) !important;
  color: var(--ec-text) !important;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.msg.user .msg-body {
  color: var(--ec-text) !important;
}

.msg.assistant:not(.thinking-msg) {
  background: var(--ec-chat-assistant-bg) !important;
}

.msg.assistant.thinking-msg {
  align-self: stretch;
  max-width: 100%;
  background: transparent !important;
  border: 0 !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 4px 2px;
}

.msg-head {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ec-text-muted);
}

.msg.assistant .msg-head { color: var(--ec-accent); }

.msg-body {
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ec-text);
  /* normal: no partir "INSTALL.md" / palabras a mitad en el panel estrecho */
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

/* Densidad tipo Claude: parrafos y listas compactos, sin aire vertical extra */
.msg-body p { margin: 0 0 14px; line-height: 1.55; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 0 0 8px; padding-left: 22px; }
.msg-body ul:last-child, .msg-body ol:last-child { margin-bottom: 0; }
.msg-body li { margin: 2px 0; }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 { margin: 12px 0 6px; line-height: 1.3; }
.msg-body h1:first-child, .msg-body h2:first-child, .msg-body h3:first-child { margin-top: 0; }
.msg-body hr { margin: 10px 0; border: 0; border-top: 1px solid #e2e8f0; }

.msg-body pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.msg-meta {
  margin-top: 6px;
  font-size: 10px;
  color: #9aacba;
}

/* imagen adjunta en el feed */
.msg-image {
  margin-top: 6px;
  max-width: 240px;
  max-height: 180px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

/* ── compositor ── */
.composer {
  position: relative;
  flex: 0 0 138px;
  display: grid;
  grid-template-rows: 1fr 30px;
  gap: 6px;
  padding: 9px 12px;
  border-top: 1px solid var(--ec-border);
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  flex-shrink: 0;
  height: 138px;
  min-height: 138px;
  max-height: 138px;
  overflow: visible;
}


.composer-input-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ec-border-strong);
  border-radius: 6px;
  background: var(--ec-bg);
  overflow: visible;
  min-height: 0;
}

.composer-input-wrap:focus-within { border-color: var(--ec-accent); }

/* ── Menú emergente de Menciones (@file, @symbol, @problems, @git, @docs) ── */
.mention-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  z-index: 10100;
  display: flex;
  flex-direction: column;
  padding: 4px;
  backdrop-filter: blur(12px);
}

.mention-popup.hidden {
  display: none !important;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: #e0e6ed;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
}

.mention-item:hover,
.mention-item.selected {
  background: rgba(88, 101, 242, 0.25);
  color: #ffffff;
  outline: 1px solid rgba(88, 101, 242, 0.4);
}

.mention-item-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.mention-item-label {
  font-weight: 600;
  color: #58a6ff;
  flex-shrink: 0;
}

.mention-item.selected .mention-item-label {
  color: #79c0ff;
}

.mention-item-detail {
  font-size: 11px;
  color: #8b949e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: auto;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: center;
  max-height: 124px;
  border-bottom: 1px solid #eef1f5;
  background: #f8fbfb;
}

.attachment-list:empty { display: none; }

.composer textarea {
  resize: none;
  flex: 1 1 auto;
  min-height: 58px;
  font-size: 13px;
  border: 0;
  border-radius: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--ec-text);
  width: 100%;
  outline: none;
}

.attachment-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid #c8dfdc;
  border-radius: 6px;
  background: #edf7f6;
  color: #1b6f79;
  overflow: hidden;
  flex-shrink: 0;
  height: 30px;
}

.attachment-chip.has-image {
  width: 136px;
  height: 68px;
  padding: 5px;
  background: #ffffff;
}

.attachment-chip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

.attachment-chip:not(:has(img)) {
  height: 24px;
  padding: 0 24px 0 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  max-width: 200px;
  max-height: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(23,32,42,.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
  flex-wrap: nowrap;
}

.composer-spacer {
  flex: 1 1 4px;
  min-width: 4px;
}
.provider-badge {
  font-size: 11px;
  color: #9aaab8;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  padding: 2px 6px;
  border-radius: 4px;
}
.provider-badge:hover { color: #526070; background: #f0f3f6; }

.composer-bar select,
.composer-bar button {
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ec-text-muted, #6c7a89);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: color 120ms, background 120ms;
  padding: 0 6px;
}

#runMode {
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--ec-text, #ffffff) !important;
  cursor: pointer;
  padding: 0 6px !important;
  height: 28px;
  line-height: 28px;
  flex-shrink: 0;
  border-radius: 4px;
}
#runMode:hover,
#runMode:focus {
  color: #ffffff !important;
  border: 0 !important;
  background: var(--ec-hover, rgba(255, 255, 255, 0.08)) !important;
}
#runMode option {
  background-color: #181a1f;
  color: #ffffff;
  font-weight: 600;
  padding: 4px 8px;
}

#permissionsBtn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ec-text-muted, #6c7a89);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 120ms, background 120ms;
}
#permissionsBtn:hover {
  background: var(--ec-hover, #edf7f6);
  color: var(--ec-accent, #1b6f79);
}
#permissionsBtn.danger,
#permissionsBtn.full {
  color: #10b981;
}
#permissionsBtn.danger:hover,
#permissionsBtn.full:hover {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
#permissionsBtn.readonly {
  color: #ef4444;
}
#permissionsBtn.readonly:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}
#permissionsBtn.step {
  color: #0284c7;
}
#permissionsBtn.step:hover {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
}

#attachBtn,
#voiceBtn,
#composerReloadAppBtn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ec-text-muted, #6c7a89);
  cursor: pointer;
  transition: color 120ms, background 120ms;
}
#attachBtn:hover,
#voiceBtn:hover,
#composerReloadAppBtn:hover {
  background: var(--ec-hover, #edf7f6);
  color: var(--ec-accent, #1b6f79);
}
#voiceBtn.active {
  background: #fde8e8;
  color: #d32f2f;
}

#sendBtn {
  background: #1b6f79;
  color: #ffffff;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
  width: 32px;
  min-width: 32px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#sendBtn:hover {
  opacity: 0.9;
}
#sendBtn.stop-mode {
  background: #fff6f6;
  color: #b94040;
  border: 1px solid #b94040;
  font-size: 13px;
}
#sendBtn.stop-mode:hover { background: #b94040; color: #fff; }
#stopBtn { background: #fff6f6; color: #b94040; border: 1px solid #b94040; font-weight: 800; width: 32px; min-width: 32px; height: 28px; padding: 0; font-size: 13px; }
#stopBtn:hover { background: #b94040; color: #fff; }
#stopBtn[hidden] { display: none; }
.chat-model-select { width: 100%; min-width: 0; max-width: 180px; height: 28px; padding: 0 24px 0 8px; border: 1px solid #1b6f79; border-radius: 6px; background: #fff; color: #174f57; font-size: 11px; font-weight: 700; text-overflow: ellipsis; }
.chat-model-select option[data-auto="1"], .chat-model-select option[value="__auto__"] { font-weight: 800; }
.chat-model-select:disabled { opacity: .55; border-color: #cbd3dc; color: #64748b; }
.hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.model-picker-wrap {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
  max-width: calc(100% - 130px);
}

.model-picker-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #d7dee6;
  border-radius: 6px;
  background: #fff;
  color: #1a2330;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 1;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.model-picker-btn:hover,
.model-picker-btn[aria-expanded="true"] {
  border-color: #1b6f79;
  background: #f4fbfa;
  box-shadow: 0 0 0 2px rgba(27, 111, 121, 0.1);
}
#modelPickerLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
  max-width: 170px;
  min-width: 32px;
}
.model-picker-caret {
  flex: 0 0 auto;
  font-size: 9px;
  color: #7a8796;
  line-height: 1;
}

.model-settings-btn {
  height: 32px;
  width: 30px;
  border: 1px solid #d7dee6;
  border-radius: 8px;
  background: #fff;
  color: #6c7a89;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.model-settings-btn:hover {
  border-color: #1b6f79;
  color: #1b6f79;
  background: #f4fbfa;
}

/* Menú de modelos — sigue el tema de la ventana (Chat/IDE) */
.model-picker-menu {
  position: fixed;
  width: min(360px, calc(100vw - 32px));
  max-height: min(480px, 58vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ec-border);
  border-radius: 14px;
  background: var(--ec-bg-elevated);
  box-shadow: 0 22px 64px var(--ec-shadow);
  z-index: 10050;
  overflow: hidden;
  color: var(--ec-text);
  font-family: inherit;
}
.model-picker-menu.hidden { display: none; }

.composer-bar .model-picker-menu button,
.model-picker-menu button {
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  box-shadow: none;
}

.model-picker-search-wrap {
  padding: 12px 12px 0;
  flex: 0 0 auto;
}
.model-picker-search {
  width: 100%;
  height: 36px;
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  background: var(--ec-bg);
  color: var(--ec-text);
  padding: 0 12px;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  box-sizing: border-box;
}
.model-picker-search::placeholder { color: var(--ec-text-muted); }
.model-picker-search:focus {
  border-color: color-mix(in srgb, var(--ec-accent) 55%, var(--ec-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ec-accent) 22%, transparent);
}

.model-picker-auto-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 14px 14px;
  border-bottom: 1px solid var(--ec-border);
  flex: 0 0 auto;
}
.model-picker-auto-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.model-picker-auto-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--ec-text);
}
.model-picker-auto-copy span {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ec-text-muted);
  font-weight: 450;
}

.model-toggle {
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  min-height: 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ec-border);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease;
  padding: 0;
  margin-top: 1px;
}
.model-toggle[aria-checked="true"] { background: var(--ec-accent); }
.model-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ec-bg-elevated);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 160ms ease;
}
.model-toggle[aria-checked="true"]::after { transform: translateX(16px); }

.model-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 8px;
  padding: 0 8px 0 10px;
  min-height: 40px;
  border-radius: 10px;
  box-sizing: border-box;
}
.model-picker-row:hover { background: var(--ec-hover); }
.model-picker-row.active {
  background: color-mix(in srgb, var(--ec-accent) 16%, transparent);
}
.model-picker-row.is-disabled .model-picker-item {
  opacity: 0.48;
}
.model-picker-row .model-toggle {
  flex: 0 0 auto;
  margin-top: 0;
}
.model-picker-row .model-picker-item {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  width: auto;
  padding: 10px 0;
}

.model-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
  margin: 0;
  color: var(--ec-text);
  cursor: pointer;
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
}
.model-picker-item:hover { background: transparent; }
.model-picker-item .model-picker-check {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}
.model-picker-row.active .model-picker-check {
  color: var(--ec-accent);
}
.model-picker-item .model-picker-name {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--ec-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 0;
}
.model-picker-row.active .model-picker-name {
  color: var(--ec-text);
  font-weight: 600;
}
.model-picker-item span.model-picker-meta {
  display: none;
}

.model-picker-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding: 6px 0 8px;
  scrollbar-color: var(--ec-border) transparent;
}
.model-picker-scroll::-webkit-scrollbar { width: 8px; }
.model-picker-scroll::-webkit-scrollbar-thumb {
  background: var(--ec-border);
  border-radius: 999px;
  border: 2px solid var(--ec-bg-elevated);
}

.model-picker-group {
  padding: 12px 18px 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ec-text-muted);
  line-height: 1.35;
}

.model-picker-empty {
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ec-text-muted);
}

.model-picker-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--ec-border);
  padding: 6px 8px;
}
.model-picker-manage {
  width: 100%;
  min-height: 36px;
  height: auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ec-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
  padding: 8px 12px;
}
.model-picker-manage:hover {
  background: var(--ec-hover);
  color: var(--ec-text);
}
#sendBtn:hover { background: #165e66; color: #ffffff; }
#sendBtn:disabled { opacity: .55; cursor: wait; }

.permission-menu {
  position: fixed;
  width: min(320px, calc(100vw - 48px));
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  background: var(--ec-bg-elevated);
  box-shadow: 0 14px 40px var(--ec-shadow);
  z-index: 10050;
  color: var(--ec-text);
}

.permission-menu button {
  display: grid;
  gap: 2px;
  text-align: left;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 8px;
  color: var(--ec-text);
  cursor: pointer;
}
.permission-menu button:hover {
  background: var(--ec-hover);
}
.permission-menu button.is-active {
  background: color-mix(in srgb, var(--ec-accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--ec-accent) 40%, var(--ec-border));
}
.permission-menu button.is-active strong { color: var(--ec-accent); }

/* ── viewer (browser) ── */
.viewer {
  grid-column: 3;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 0;
  background: var(--ec-bg-elevated);
  overflow: hidden;
  color: var(--ec-text);
}

.viewer.has-logs {
  grid-template-rows: auto minmax(0, 1fr) 5px var(--viewer-logs-height, 220px);
}

.viewer-url {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--ec-border);
  background: var(--ec-bg-elevated);
  min-width: 0;
  overflow: hidden;
}

.viewer-mode-group,
.viewer-nav-group,
.viewer-action-group {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.viewer-mode-group {
  flex: 0 0 auto;
  gap: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--ec-border);
}

.viewer-nav-group {
  flex: 1 1 auto;
  gap: 6px;
}

.viewer-action-group {
  flex: 0 0 auto;
  gap: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--ec-border);
}

/* Botones solo texto: sin recuadro, push + color */
.text-action-btn,
.preview-mode-btn,
.preview-nav-btn,
.preview-inspect-btn,
.refresh-btn,
.project-open-btn,
.app-toolbar .toolbar-connect-btn {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
  font-weight: 600;
  transition: color 120ms ease, opacity 120ms ease, transform 80ms ease;
}

.preview-mode-btn {
  min-width: 0;
  height: auto;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--ec-text-muted);
  white-space: nowrap;
}

.preview-mode-btn:hover {
  color: var(--ec-accent) !important;
  background: transparent !important;
}

.preview-mode-btn.active {
  color: var(--ec-accent) !important;
  background: transparent !important;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.preview-mode-btn:active,
.text-action-btn:active,
.preview-nav-btn:active,
.preview-inspect-btn:active,
.refresh-btn:active,
.project-open-btn:active,
.app-toolbar .toolbar-connect-btn:active {
  transform: translateY(1px);
  opacity: 0.75;
}

.preview-nav-btn,
.refresh-btn {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 4px 6px;
  font-size: 14px;
  color: var(--ec-text-muted);
}

.preview-nav-btn:hover:not(:disabled),
.refresh-btn:hover {
  color: var(--ec-accent) !important;
  background: transparent !important;
  filter: none;
  border: 0 !important;
}

.preview-nav-btn:disabled {
  color: var(--ec-text-muted);
  opacity: 0.35;
  background: transparent !important;
  cursor: default;
}

.refresh-btn:active,
.refresh-btn.refreshing {
  background: transparent !important;
  border: 0 !important;
  color: var(--ec-accent) !important;
}

.preview-inspect-btn,
.viewer-action-group .text-action-btn {
  height: auto;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--ec-text-muted);
  white-space: nowrap;
}

.preview-inspect-btn:hover,
.viewer-action-group .text-action-btn:hover {
  color: var(--ec-accent) !important;
  background: transparent !important;
}

.viewer-url input {
  height: 28px;
  min-width: 0;
  flex: 1 1 auto;
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ec-bg-soft, #f3f5f7);
  color: var(--ec-text);
}

.viewer-url input:focus {
  outline: 1px solid color-mix(in srgb, var(--ec-accent) 35%, transparent);
}

.editor-path-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  color: var(--ec-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.ide-code-mode .viewer-nav-group #previewUrl,
body.ide-code-mode .viewer-nav-group #previewBackBtn,
body.ide-code-mode .viewer-nav-group #openPreviewBtn,
body.ide-code-mode #inspectBrowserBtn {
  display: none !important;
}

body.ide-web-mode #editorPathLabel,
body.ide-web-mode #saveEditorBtn,
body.ide-web-mode #gotoDefBtn,
body:not(.ide-code-mode) #saveEditorBtn,
body:not(.ide-code-mode) #gotoDefBtn,
body:not(.ide-code-mode) #editorPathLabel {
  display: none !important;
}

body.ide-code-mode .viewer-action-group {
  border-left-color: transparent;
}

.viewer-body {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  background: var(--ec-preview-bg);
}

.preview-webview {
  grid-area: 1 / 1;
  display: inline-flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 0;
  background: var(--ec-preview-bg);
}
.viewer[data-preview-mode="mobile"] .viewer-body {
  background: var(--ec-preview-bg);
}
.viewer[data-preview-mode="mobile"] .preview-webview {
  align-self: center;
  justify-self: center;
  width: min(390px, calc(100% - 24px));
  height: calc(100% - 24px);
  border: 1px solid var(--ec-border-strong);
  border-radius: 18px;
  box-shadow: 0 10px 30px var(--ec-shadow);
  overflow: hidden;
  background: var(--ec-preview-bg);
}
.viewer[data-preview-mode="mobile"] .preview-status {
  width: min(390px, calc(100% - 24px));
  height: calc(100% - 24px);
  margin: 12px auto;
  border-radius: 18px;
}
.agent-approval-diff {
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid #d7dee7;
  background: #0f172a;
  color: #e2e8f0;
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.agent-pipeline-strip,
.pipeline-pill,
.pipeline-label,
.pipeline-value {
  display: none !important;
}

.chat-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-specialist-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #94a3b8;
  color: #334155;
  background: #e2e8f0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-specialist-badge.is-idle {
  opacity: 0.55;
}
.agent-specialist-badge[data-kind="ui"] {
  color: #fff;
  border-color: #7c3aed;
  background: #7c3aed;
}
.agent-specialist-badge[data-kind="devops"] {
  color: #fff;
  border-color: #c2410c;
  background: #c2410c;
}
.agent-specialist-badge[data-kind="database"] {
  color: #fff;
  border-color: #0369a1;
  background: #0369a1;
}
.agent-specialist-badge[data-kind="verifier"],
.agent-specialist-badge[data-kind="auto-heal"],
.agent-specialist-badge[data-kind="global-memory"] {
  color: #fff;
  border-color: #0f766e;
  background: #0f766e;
}
.agent-specialist-badge[data-kind="security"] {
  color: #fff;
  border-color: #b91c1c;
  background: #b91c1c;
}
.agent-specialist-badge[data-kind="implementer"],
.agent-specialist-badge[data-kind="explorer"],
.agent-specialist-badge[data-kind="planner"] {
  color: #fff;
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.preview-heal-banner {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #99f6e4;
  background: linear-gradient(180deg, #ecfdf5 0%, #f0fdfa 100%);
  color: #115e59;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
}
.preview-heal-banner.hidden,
.preview-heal-banner[hidden] {
  display: none !important;
}
.preview-heal-banner.is-warn {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
}
.preview-heal-banner-body {
  flex: 1;
  min-width: 0;
}
.preview-heal-banner strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}
.preview-heal-banner button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}
.preview-heal-banner button:hover {
  opacity: 1;
}

.subagent-rail,
.subagent-pill,
.agent-specialist-badge,
.agent-thought-panel,
.agent-plan-panel {
  display: none !important;
}

/* Thought accordion Cursor: summary visible (antes hide legacy lo mataba). */
.agent-execution-card .agent-thought-summary {
  display: block !important;
}

/* Stream continuo tipo Cursor: texto plano progresivo, sin tarjetas. */
.agent-live-stream {
  margin: 6px 0 2px;
  padding: 0;
  border: 0;
  background: transparent;
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-thought-stream {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-thought-line {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ec-text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  border: 0;
  background: transparent;
  padding: 0;
}
.agent-thought-line.is-action,
.agent-thought-line.is-stream {
  color: var(--ec-text);
}
.agent-thought-line.is-meta {
  color: var(--ec-text-muted);
  font-style: italic;
}

.agent-execution-container {
  margin-top: 4px;
  border: 0;
  padding: 0;
}
.msg-body .agent-execution-container {
  margin-top: 4px;
  border: 0;
}
.agent-narrative-log {
  margin-top: 4px;
  border: 0;
}

/* Chat limpio: sin recuadro de plan encima del feed (estado interno). */
.agent-plan-panel {
  display: none !important;
}
.agent-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  color: #334155;
}
.agent-plan-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #64748b;
}
.agent-plan-todos {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: #1e293b;
}
.agent-plan-todos li[data-status="done"] { color: #15803d; text-decoration: line-through; }
.agent-plan-todos li[data-status="error"] { color: #b91c1c; }
.agent-plan-todos li[data-status="pending"] { color: #475569; }
.agent-plan-checkpoints {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}
.preview-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--ec-text-muted);
  background: var(--ec-preview-bg);
  font-size: 13px;
  z-index: 2;
}
.preview-status.hidden { display: none !important; }
body.ide-code-mode #previewStatus,
body.ide-code-mode .preview-status {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: 0 !important;
}
.monaco-editor-host {
  grid-area: 1 / 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  z-index: 5;
  background: #1e1e1e;
  display: block;
}
.monaco-editor-host[hidden] {
  display: none !important;
}
body.ide-code-mode .monaco-editor-host {
  display: block !important;
}
body.ide-code-mode .preview-webview,
.preview-webview.is-hidden-for-editor {
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: 0 !important;
}
/* Sin modo Código: el navegador siempre visible */
body:not(.ide-code-mode) .preview-webview {
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 1 !important;
}
body:not(.ide-code-mode) .monaco-editor-host {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: 0 !important;
}
.monaco-fallback-error {
  color: #fecaca;
  padding: 24px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 420px;
}
.monaco-fallback-error strong { color: #fff; }
.monaco-diff-line-add { background: rgba(34, 197, 94, 0.12) !important; }
.monaco-diff-line-del { background: rgba(239, 68, 68, 0.12) !important; }
.monaco-diff-glyph-add {
  background: #22c55e;
  width: 4px !important;
  margin-left: 3px;
}
.monaco-diff-glyph-del {
  background: #ef4444;
  width: 4px !important;
  margin-left: 3px;
}
.preview-runtime-errors {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  max-height: 140px;
  overflow: auto;
  border: 1px solid #e2b4b4;
  border-radius: 8px;
  background: #fff6f6;
  color: #7a3030;
  padding: 8px 10px;
  font-size: 12px;
}
.browser-inspect-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 46%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  background: #0f1419;
  color: #e8eef4;
  border-left: 1px solid #2a3340;
}
.browser-inspect-panel.hidden { display: none; }
.browser-inspect-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #2a3340;
  font-size: 12px;
}
.browser-inspect-head button {
  border: 0;
  background: transparent;
  color: #9aa3ad;
  cursor: pointer;
  font-size: 14px;
}
.browser-inspect-actions {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #2a3340;
}
.browser-inspect-actions input {
  width: 100%;
  height: 28px;
  border: 1px solid #2a3340;
  border-radius: 6px;
  background: #18222c;
  color: #e8eef4;
  padding: 0 8px;
  font-size: 11px;
}
.browser-inspect-action-row {
  display: flex;
  gap: 6px;
}
.browser-inspect-action-row button {
  flex: 1 1 0;
  height: 28px;
  border: 1px solid #2a3340;
  border-radius: 6px;
  background: #1b6f79;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.browser-inspect-action-row #browserInspectRefreshBtn {
  flex: 0 0 36px;
  background: #24303a;
}
.browser-inspect-body {
  margin: 0;
  padding: 10px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.preview-runtime-errors-title { font-weight: 600; margin-bottom: 4px; }
.preview-runtime-error-line + .preview-runtime-error-line { margin-top: 2px; }

/* ── splitters (hit-area 10px, línea 1px tipo Cursor) ── */
.splitter {
  position: relative;
  width: 10px;
  background: var(--ec-bg);
  cursor: col-resize;
  touch-action: none;
  z-index: 5;
}
.splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  margin-left: -0.5px;
  border-radius: 0;
  background: var(--ec-border);
  opacity: 1;
}
#splitChatBrowser { grid-column: 2; grid-row: 2; }
#splitBrowserProjects { grid-column: 4; grid-row: 2; }
.splitter:hover::before, .splitter.dragging::before { background: var(--ec-accent); opacity: 1; }
body.resizing-panels, body.resizing-panels * { user-select: none !important; cursor: col-resize !important; }
body.resizing-panels webview, body.resizing-panels iframe { pointer-events: none !important; }

/* ── dialogs base ── */
dialog:not([open]) { display: none !important; }
dialog {
  grid-column: 1;
  grid-row: 1;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 40px));
  border: 1px solid #dde2e8;
  border-radius: 12px;
  padding: 0;
  background: #ffffff;
  color: #17202a;
  margin: 0;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}
dialog::backdrop { background: rgba(23,32,42,.32); }

dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #eef1f5;
}

dialog h2 { margin: 0; font-size: 17px; }
dialog header p { margin: 3px 0 0; color: #6c7a89; font-size: 12px; }

.dialog-close {
  height: 30px;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  background: #ffffff;
  color: #526070;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

dialog .body { padding: 16px 20px; }
dialog#brainDialog { width: min(780px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }
#brainDialog form { min-width: 0; max-width: 100%; }
dialog .brain-body { min-width: 0; max-height: min(70vh, 680px); overflow: auto; box-sizing: border-box; }
.brain-search-row,
.brain-repo-row { display:grid; grid-template-columns: minmax(0, 1fr) auto; gap:8px; margin-bottom:10px; }
.brain-actions-row { display:flex; justify-content:flex-end; gap:8px; margin-bottom:10px; }
.brain-search-row input,
.brain-repo-row input { min-width:0; width:100%; box-sizing:border-box; }
.brain-actions-row button,
.brain-repo-row button { border:1px solid #1b6f79; color:#1b6f79; background:#fff; border-radius:7px; padding:6px 10px; cursor:pointer; font-weight:700; }
.brain-actions-row button:hover,
.brain-repo-row button:hover { background:#edf7f6; }
.brain-status { color:#64748b; font-size:12px; margin-bottom:10px; }
.brain-health { display:flex; align-items:center; gap:7px; padding:8px 10px; margin-bottom:8px; border:1px solid #c9e8e4; border-radius:8px; background:#f2fbfa; color:#17636b; font-size:12px; }
.brain-health[data-state="error"] { border-color:#f2c7c7; background:#fff6f6; color:#a33a3a; }
.brain-health-dot { width:9px; height:9px; border-radius:50%; background:#24a148; flex:0 0 auto; }
.brain-health[data-state="checking"] .brain-health-dot { background:#c78b19; }
.brain-health[data-state="error"] .brain-health-dot { background:#d64545; }
.brain-snapshot { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.brain-chip { background:#eef7f6; border:1px solid #c9e8e4; border-radius:999px; padding:4px 8px; font-size:11px; }
.brain-tools-audit { display:grid; gap:6px; margin-bottom:12px; }
.brain-audit-row { border:1px solid #dbe5ea; border-radius:8px; padding:7px 9px; background:#fff; font-size:12px; color:#334155; }
.brain-audit-row[data-state="error"] { border-color:#f2c7c7; background:#fff6f6; color:#923838; }
.brain-audit-row[data-state="ok"] { border-color:#c9e8e4; background:#f2fbfa; color:#17636b; }
.brain-catalog-list { display:grid; gap:8px; }
.brain-card { border:1px solid #dbe5ea; border-radius:10px; padding:10px 12px; background:#fff; }
.brain-card-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.brain-card-title { font-weight:700; }
.brain-card-meta { color:#64748b; font-size:11px; margin-top:4px; }
.brain-install-btn { border:1px solid #1b6f79; color:#1b6f79; background:#fff; border-radius:7px; padding:5px 9px; cursor:pointer; }
.brain-install-btn:disabled { opacity:.6; cursor:default; }
#inspectorDialog { width:min(820px, calc(100vw - 32px)); max-width:calc(100vw - 32px); }
#inspectorDialog form { min-width:0; max-width:100%; }
dialog .inspector-body { min-width:0; height:min(76vh, 760px); display:grid; grid-template-rows:auto auto auto auto auto minmax(0,1fr); gap:10px; overflow:hidden; box-sizing:border-box; }
.inspector-health { display:flex; align-items:center; gap:7px; padding:8px 10px; border:1px solid #c9e8e4; border-radius:8px; background:#f2fbfa; color:#17636b; font-size:12px; }
.inspector-health[data-state="error"] { border-color:#f2c7c7; background:#fff6f6; color:#a33a3a; }
.inspector-health[data-state="checking"] { border-color:#ead49a; background:#fff9e8; color:#8a6413; }
.inspector-health-dot { width:9px; height:9px; border-radius:50%; background:#24a148; flex:0 0 auto; }
.inspector-health[data-state="checking"] .inspector-health-dot { background:#c78b19; }
.inspector-health[data-state="error"] .inspector-health-dot { background:#d64545; }
.inspector-api { border:1px solid #dbe5ea; border-radius:8px; background:#fff; padding:8px 10px; }
.inspector-api summary { cursor:pointer; color:#334155; font-size:12px; font-weight:900; list-style:none; }
.inspector-api summary::-webkit-details-marker { display:none; }
.inspector-api-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr) minmax(0,1fr) auto; gap:7px; align-items:center; margin-top:8px; }
.inspector-api-grid input { min-width:0; height:31px; border:1px solid #cbd3dc; border-radius:6px; padding:0 9px; font-size:12px; }
.inspector-api-grid button { height:31px; border:1px solid #1b6f79; border-radius:6px; background:#1b6f79; color:#fff; padding:0 11px; font-size:12px; font-weight:800; cursor:pointer; }
.inspector-api-grid button:disabled { opacity:.6; cursor:wait; }
.inspector-api-status { margin-top:6px; color:#64748b; font-size:11px; }
.inspector-api-status.ok { color:#17636b; font-weight:800; }
.inspector-api-status.error { color:#a33a3a; font-weight:800; }
.inspector-model-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }
.inspector-model-selector-group { display:flex; flex-direction:column; gap:3px; }
.inspector-model-selector-group label { font-size:11px; font-weight:700; color:#475569; white-space:nowrap; }
.inspector-model-row select { width:100%; height:31px; border:1px solid #cbd3dc; border-radius:6px; padding:0 8px; font-size:12px; background:#fff; color:#1e293b; cursor:pointer; }
.inspector-model-row select:focus { outline:2px solid #1b6f79; border-color:#1b6f79; }
.inspector-actions { display:flex; flex-wrap:wrap; gap:6px; padding-bottom:2px; align-items:center; }
.inspector-actions button { height:30px; border:1px solid #cbd3dc; border-radius:6px; background:#fff; color:#334155; padding:0 10px; font-size:11px; font-weight:800; cursor:pointer; transition:background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease; }
.inspector-actions button:hover { border-color:#1b6f79; color:#1b6f79; background:#edf7f6; }
.inspector-actions button:disabled { opacity:.55; cursor:not-allowed; }
.inspector-actions button.is-active,
.inspector-actions button[data-busy="1"] {
  border-color:#c9951a;
  background:#f6c84c;
  color:#5a3d00;
  box-shadow:0 0 0 2px rgba(226, 184, 77, 0.35);
  cursor:wait;
  opacity:1;
}
.inspector-actions button[data-inspector-action="repair"].needs-attention {
  border-color:#1b6f79;
  background:#1b6f79;
  color:#fff;
}
.inspector-actions .inspector-cancel-btn {
  border-color:#d64545;
  background:#fff5f5;
  color:#a33a3a;
}
.inspector-actions .inspector-cancel-btn:hover {
  border-color:#b83232;
  background:#d64545;
  color:#fff;
}
.inspector-composer-actions .inspector-save-btn {
  border:1px solid #cbd3dc;
  background:#fff;
  color:#334155;
}
.inspector-progress { display:grid; gap:6px; border:1px solid #dbe5ea; border-radius:8px; background:#fff; padding:8px 10px; }
.inspector-progress[data-state="running"] { border-color:#e2b84d; background:#fffbeb; }
.inspector-progress-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; color:#526070; font-size:11px; font-weight:800; }
.inspector-progress-meta span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.inspector-progress-track { width:100%; height:9px; overflow:hidden; border-radius:999px; background:#e8eef2; }
.inspector-progress-fill { width:0%; height:100%; border-radius:inherit; background:#1b6f79; transition:width 180ms ease, background 120ms ease; }
.inspector-progress[data-state="running"] .inspector-progress-fill { background:#e2b84d; }
.inspector-progress[data-state="complete"] { border-color:#c9e8e4; background:#f2fbfa; }
.inspector-progress[data-state="complete"] .inspector-progress-meta { color:#17636b; }
.inspector-progress[data-state="error"] { border-color:#f2c7c7; background:#fff6f6; }
.inspector-progress[data-state="error"] .inspector-progress-meta { color:#a33a3a; }
.inspector-progress[data-state="error"] .inspector-progress-fill { background:#d64545; }
.inspector-handoff { justify-self:start; height:32px; border:1px solid #1b6f79; border-radius:6px; background:#1b6f79; color:#fff; padding:0 12px; font-size:12px; font-weight:800; cursor:pointer; }
.inspector-handoff:hover { background:#145a63; }
.inspector-tabs { display:flex; gap:6px; border-bottom:1px solid #e6edf0; padding-bottom:8px; }
.inspector-tabs button { height:30px; border:1px solid #cbd3dc; border-radius:6px; background:#fff; color:#526070; padding:0 12px; font-size:12px; font-weight:800; cursor:pointer; }
.inspector-tabs button.active { border-color:#1b6f79; background:#1b6f79; color:#fff; }
.inspector-pane { display:none; min-height:0; overflow:hidden; }
.inspector-pane.active { display:grid; }
#inspectorChatPane { grid-template-rows:1fr auto; gap:10px; }
.inspector-feed { min-height:0; overflow:auto; display:flex; flex-direction:column; gap:10px; padding:4px 2px; }
.inspector-msg { border:1px solid #dbe5ea; border-radius:8px; padding:9px 10px; background:#fff; color:#263544; font-size:13px; line-height:1.45; white-space:pre-wrap; word-break:break-word; }
.inspector-msg h2, .inspector-msg h3 { margin:8px 0 6px; font-size:14px; }
.inspector-msg table { width:100%; border-collapse:collapse; margin:6px 0; white-space:normal; }
.inspector-msg th, .inspector-msg td { border:1px solid #dbe5ea; padding:5px 7px; text-align:left; vertical-align:top; }
.inspector-msg th { background:#f6f8fa; color:#334155; }
.inspector-msg.user { align-self:flex-end; max-width:78%; background:#eef7f6; border-color:#c9e8e4; }
.inspector-msg.assistant { align-self:stretch; }
.inspector-msg-head { margin-bottom:5px; font-size:10px; font-weight:900; text-transform:uppercase; color:#6c7a89; }
.inspector-composer { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:8px; align-items:end; }
.inspector-composer textarea { min-height:74px; resize:none; border:1px solid #cbd3dc; border-radius:7px; padding:9px 10px; font-size:13px; outline:none; }
.inspector-composer textarea:focus { border-color:#1b6f79; }
.inspector-composer button { height:36px; min-width:84px; border:1px solid #1b6f79; border-radius:7px; background:#1b6f79; color:#fff; font-weight:800; cursor:pointer; }
.inspector-composer button:disabled { opacity:.6; cursor:wait; }
.inspector-composer #inspectorPublishBtn { background:#0f5960; border-color:#0f5960; }
.inspector-composer #inspectorPublishBtn:hover:not(:disabled) { background:#0d4f56; }
/* Publish button: estilo unificado con la barra (solo texto) */
.app-toolbar #publishBtn:disabled { opacity:.55; cursor:wait; }
.app-toolbar #publishBtn.is-not-ready,
.app-toolbar #publishBtn.is-not-ready:hover { color:#9ca3af !important; background:transparent !important; cursor:not-allowed; }
.app-toolbar #publishBtn.is-ready { color:#fff !important; background:#2563eb !important; border-radius:4px !important; margin:0 4px; }
.app-toolbar #publishBtn.is-ready:hover { color:#fff !important; background:#1d4ed8 !important; }
#inspectorReportsPane { grid-template-rows:auto 1fr; gap:10px; }
.inspector-summary { display:flex; flex-wrap:wrap; gap:6px; min-height:28px; }
.inspector-chip { background:#eef7f6; border:1px solid #c9e8e4; border-radius:999px; padding:4px 8px; color:#17636b; font-size:11px; font-weight:800; }
.inspector-reports-list { min-height:0; overflow:auto; display:grid; align-content:start; gap:8px; }
.inspector-report { border:1px solid #dbe5ea; border-radius:8px; background:#fff; padding:10px 12px; display:grid; gap:5px; font-size:12px; color:#334155; }
.inspector-report[data-severity="high"] { border-color:#efcaca; background:#fff7f7; }
.inspector-report[data-severity="medium"] { border-color:#ead49a; background:#fffbf0; }
.inspector-report-title { font-weight:900; color:#17202a; }
.inspector-report-meta { font-size:10px; color:#6c7a89; font-weight:800; text-transform:uppercase; }
.inspector-report-findings { margin:2px 0 0; padding-left:18px; color:#526070; }
dialog footer { padding: 12px 20px 18px; display: flex; justify-content: flex-end; }

/* ── settings dialog ── */
.dlg-body { padding: 16px 20px 4px; }
.dlg-body > .field-label { display:block; margin:0 0 6px; color:#526070; font-size:12px; font-weight:700; }
.dlg-body > input, .dlg-body > select { width:100%; height:36px; margin:0 0 14px; padding:0 10px; border:1px solid #cbd3dc; border-radius:6px; background:#fff; color:#17202a; }
#newProjectDialog { width:min(620px, calc(100vw - 32px)); }
#newProjectDialog .dlg-actions button { min-height:34px; padding:0 14px; border:0; border-radius:6px; background:#1b6f79; color:#fff; font-weight:700; cursor:pointer; }
#newProjectDialog .dlg-actions button:disabled { opacity:.55; cursor:wait; }
#newProjectDialog .dlg-actions .project-create-cancel { border:1px solid #cbd3dc; background:#fff; color:#526070; }
.new-project-body { display:grid; grid-template-columns:1fr; }
.project-parent-row { display:grid; grid-template-columns:minmax(0, 1fr) auto; gap:8px; margin:0 0 14px; }
.project-parent-row input { min-width:0; height:36px; padding:0 10px; border:1px solid #cbd3dc; border-radius:6px; color:#17202a; }
.project-parent-row button { min-width:72px; border:1px solid #1b6f79; border-radius:6px; background:#fff; color:#1b6f79; font-weight:700; }
.project-template-summary { display:grid; gap:5px; margin:-4px 0 14px; padding:0 1px; color:#526070; }
.project-template-summary strong { color:#17202a; font-size:13px; }
.project-template-summary span { font-size:12px; line-height:1.4; }
.project-template-summary small { color:#64748b; line-height:1.4; }
.project-create-progress { display:grid; gap:7px; margin:2px 0 12px; border-top:1px solid #dbe5ea; padding-top:12px; }
.project-create-progress-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; color:#526070; font-size:11px; font-weight:800; }
.project-create-progress-meta span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-create-progress-track { width:100%; height:9px; overflow:hidden; border-radius:999px; background:#e8eef2; }
#projectCreateProgressFill { width:0; height:100%; background:#1b6f79; transition:width 180ms ease; }
.project-create-progress[data-state="error"] #projectCreateProgressFill { background:#c83e3e; }
.project-create-progress[data-state="complete"] #projectCreateProgressFill { background:#16856f; }
.project-create-log { height:118px; margin:0; overflow:auto; border:1px solid #dbe5ea; border-radius:6px; background:#18222c; color:#dce7ee; padding:9px 10px; font:11px/1.45 Consolas, monospace; white-space:pre-wrap; word-break:break-word; }
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
  font-size: 12px;
  font-weight: 700;
  color: #526070;
}

.field input, .field select { height: 34px; padding: 0 10px; font-size: 13px; border: 1px solid #cbd3dc; border-radius: 6px; background: #fff; color: #17202a; width: 100%; }

.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.segments button {
  border: 1px solid #1b6f79;
  background: #ffffff;
  color: #1b6f79;
  height: 34px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}
.segments button.active { background: #1b6f79; color: #ffffff; }

.check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #526070; }
.check input { width: auto; }

.fetch-models-btn {
  height: 22px;
  border: 1px solid #1b6f79;
  border-radius: 5px;
  background: transparent;
  color: #1b6f79;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 7px;
  margin-left: 6px;
  vertical-align: middle;
  transition: background 120ms;
}
.fetch-models-btn:hover { background: #edf7f6; }
.fetch-models-btn:disabled { opacity: .6; cursor: wait; }

.api-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  vertical-align: middle;
  margin-left: 5px;
  transition: background 300ms;
}
.api-dot.active   { background: #22c55e; }
.api-dot.inactive { background: #ef4444; }
.api-dot.checking { background: #f59e0b; }

.btn-primary {
  height: 36px;
  border: 1px solid #1b6f79;
  background: #1b6f79;
  color: #ffffff;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: filter 120ms;
}
.btn-primary:hover { filter: brightness(1.07); }

.btn-outline {
  height: 36px;
  border: 1px solid #cbd3dc;
  background: #fff;
  color: #174f57;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
}
.btn-outline:hover { background: #f0faf9; border-color: #1b6f79; }

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

.privacy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #2f4050;
  margin-right: auto;
  cursor: pointer;
}

.providers-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0faf9;
  border: 1px solid #c9ece8;
  color: #174f57;
  font-size: 12px;
  line-height: 1.45;
}

/* ── connections dialog ── */
#connectionsDialog { width: min(760px, calc(100vw - 32px)); }
#connectionsDialog form {
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.connections-body {
  padding: 14px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.maintenance-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.maintenance-item {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  font-size: 13px;
  line-height: 1.45;
}

.maintenance-item strong {
  color: #e8eef5;
}

.maintenance-item small {
  color: #8a97a6;
}

.conn-section {
  margin-bottom: 18px;
}

.conn-preview-note {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #fff4dd;
  color: #7a4a00;
  font-size: 12px;
  font-weight: 600;
}
.conn-preview-note[hidden] { display: none; }
.conn-section-title {
  font-size: 11px;
  font-weight: 800;
  color: #6c7a89;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}

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

.conn-field {
  display: grid;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #526070;
}

.conn-field input {
  height: 32px;
  padding: 0 9px;
  font-size: 12px;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  width: 100%;
}

.oauth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.conn-connect-btn {
  height: 32px;
  border: 1px solid #1b6f79;
  border-radius: 6px;
  background: #1b6f79;
  color: #ffffff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 120ms;
}
.conn-connect-btn:hover { filter: brightness(1.08); }

.conn-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0f4f8;
  color: #6c7a89;
  margin-left: 6px;
}
.conn-status.connected { background: #e0f5ef; color: #1a7a5a; }
.conn-status.error { background: #fde8e8; color: #b42318; }

/* ── models dialog ── */
#providersDialog,
.models-dialog {
  width: min(680px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dde2e8;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(23, 32, 42, 0.18);
}

#providersDialog form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.providers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 14px 20px;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #9aacba #eef1f5;
  scrollbar-width: auto;
  flex: 1;
  min-height: 0;
}

.providers-list::-webkit-scrollbar { width: 10px; }
.providers-list::-webkit-scrollbar-track { background: #eef1f5; border-radius: 5px; }
.providers-list::-webkit-scrollbar-thumb { background: #9aacba; border: 2px solid #eef1f5; border-radius: 5px; }
.providers-list::-webkit-scrollbar-thumb:hover { background: #73889a; }

#providersDialog .dlg-head,
#providersDialog .dlg-footer {
  flex: 0 0 auto;
}

.provider-row {
  display: grid;
  grid-template-columns: 100px 1fr 120px auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e8ecf0;
  border-radius: 8px;
  background: #fafbfc;
}

.provider-row.active-provider { border-color: #1b6f79; background: #f0faf9; }

.provider-name { font-size: 13px; font-weight: 700; color: #17202a; }
.provider-name small { display: block; font-size: 10px; color: #6c7a89; font-weight: 500; margin-top: 1px; }

.provider-row input {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  width: 100%;
}

.provider-use-btn {
  height: 30px;
  border: 1px solid #1b6f79;
  border-radius: 6px;
  background: #ffffff;
  color: #1b6f79;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 10px;
  white-space: nowrap;
  transition: background 120ms;
}
.provider-use-btn:hover { background: #edf7f6; }
.provider-row.active-provider .provider-use-btn { background: #1b6f79; color: #ffffff; }

.provider-del-btn {
  height: 30px;
  width: 30px;
  border: 1px solid #e0e5ea;
  border-radius: 6px;
  background: transparent;
  color: #9aacba;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.provider-del-btn:hover { border-color: #e0603a; color: #e0603a; background: #fff5f2; }

.providers-footer {
  padding: 12px 20px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #eef1f5;
  margin-top: 6px;
}

.add-provider-btn {
  height: 34px;
  border: 1px dashed #1b6f79;
  border-radius: 7px;
  background: transparent;
  color: #1b6f79;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 14px;
  transition: background 120ms;
}
.add-provider-btn:hover { background: #edf7f6; }

/* ── project list panel ── */
.project-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  border-bottom: 1px solid #edf0f2;
  padding-bottom: 2px;
  gap: 5px;
}

.project-item {
  width: 100%;
  min-height: 44px;
  display: grid;
  gap: 2px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #ffffff;
  color: #17202a;
  padding: 8px 9px;
  cursor: pointer;
  font: inherit;
}
.project-item:hover { background: #f2f6f7; }
.project-item.active { border-color: #c8dfdc; background: #edf7f6; }
.project-item span { overflow: visible; text-overflow: clip; white-space: normal; word-break: break-word; font-size: 13px; font-weight: 700; line-height: 1.3; }
.project-item small { color: #6c7a89; font-size: 10px; }

#projectsDialog {
  width: min(760px, calc(100vw - 32px));
}

#projectsDialog form {
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.projects-manager {
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.projects-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.projects-manager-list {
  max-height: min(460px, 62vh);
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.projects-manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.project-remove-btn {
  width: 64px;
  min-width: 64px;
  border: 1px solid #e6ccd0;
  border-radius: 7px;
  background: #fff7f8;
  color: #9f3443;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.project-remove-btn:disabled {
  cursor: default;
  opacity: .45;
}

.projects-manager-empty {
  padding: 16px 4px;
  color: #6c7a89;
  font-size: 12px;
}

input, textarea, button { font: inherit; }

/* ── dialog helpers ── */
.dlg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #eef1f5;
}
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-head p  { margin: 3px 0 0; color: #6c7a89; font-size: 12px; }

.dlg-close {
  height: 30px;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  background: #ffffff;
  color: #526070;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.dlg-close:hover { background: #f4f7f9; }

.dlg-footer {
  padding: 12px 20px 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #eef1f5;
  flex-wrap: wrap;
}

.btn-outline-teal {
  height: 36px;
  border: 1px solid #1b6f79;
  background: transparent;
  color: #1b6f79;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: background 120ms;
}
.btn-outline-teal:hover { background: #edf7f6; }

/* toolbar brand elements */
.toolbar-brand { font-size: 12px; font-weight: 600; color: var(--ec-text); white-space: nowrap; }
html[data-theme="gris"] .toolbar-brand,
html[data-theme="negro"] .toolbar-brand,
html[data-theme="azul"] .toolbar-brand {
  color: var(--ec-text);
}
html[data-theme="blanco"] .toolbar-brand,
html[data-theme=""] .toolbar-brand {
  color: var(--ec-text);
}

/* ── providers dialog details/summary ── */
.providers-section-title {
  margin: 4px 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9aacba;
}

.prov-item {
  flex: 0 0 auto;
  border: 1px solid #e8ecf0;
  border-radius: 12px;
  background: #fafbfc;
  overflow: hidden;
}

.prov-item[open] {
  border-color: #c9ece8;
  background: #fff;
  box-shadow: 0 4px 16px rgba(27, 111, 121, 0.06);
  overflow: visible;
}

.prov-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.provider-state { margin-left:auto; padding:3px 7px; border-radius:999px; background:#eef1f5; color:#64748b; font-size:10px; font-weight:700; }
.provider-state.active { background:#e8f7ef; color:#16824b; }
.provider-state.checking { background:#fff6df; color:#9a6810; }
.provider-state.inactive { background:#fff0f0; color:#b43b3b; }
.provider-profiles { display:grid; gap:8px; margin-top:10px; }
.gateway-model-provider { margin:8px 0 0; padding:7px 2px 2px; border-top:1px solid #dbe5ea; color:#17202a; font-size:12px; font-weight:900; }
.gateway-model-provider:first-child { margin-top:0; border-top:0; }
.provider-profile { display:grid; grid-template-columns:minmax(100px,1fr) minmax(120px,1.2fr) auto; gap:7px; align-items:center; padding:8px; border:1px solid #dbe5ea; border-radius:7px; background:#fff; min-width:0; }
.provider-profile.is-single-key { grid-template-columns:minmax(100px,1fr) auto; }
.provider-profile input[hidden] { display:none; }
.provider-profile input { min-width:0; width:100%; height:32px; padding:0 8px; border:1px solid #cbd3dc; border-radius:6px; box-sizing:border-box; }
.provider-profile-status { font-size:10px; font-weight:700; color:#64748b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.provider-profile-status.active { color:#16824b; }
.provider-profile-status.inactive { color:#b43b3b; }
.provider-profile button { height:32px; padding:0 8px; border:1px solid #1b6f79; border-radius:6px; background:#fff; color:#1b6f79; cursor:pointer; white-space:nowrap; }
.provider-profile .profile-delete { border-color:#efcaca; color:#b43b3b; }
.provider-profile-actions { grid-column:1 / -1; display:flex; justify-content:flex-end; gap:7px; flex-wrap:wrap; }
.provider-profile-actions .profile-save { color:#526070; border-color:#cbd3dc; }
.provider-profile-actions .profile-verify { background:#1b6f79; color:#fff; min-width:140px; }
.provider-model-picker { display:grid; gap:7px; }
.provider-model-picker-row { display:grid; grid-template-columns:minmax(150px, .8fr) minmax(220px, 1.4fr); gap:7px; }
.provider-model-picker input[type="search"], .provider-model-select { min-width:0; height:34px; padding:0 9px; border:1px solid #cbd3dc; border-radius:6px; background:#fff; color:#17202a; }
.provider-model-select { width:100%; cursor:pointer; }
.provider-model-show-all { display:flex; align-items:center; gap:6px; color:#526070; font-size:11px; }
.provider-model-show-all input { width:14px; height:14px; }
.provider-model-selection-actions { display:flex; gap:6px; flex-wrap:wrap; }
.provider-model-selection-actions button { height:30px; padding:0 8px; border:1px solid #cbd3dc; border-radius:6px; background:#fff; color:#526070; cursor:pointer; font-size:11px; }
.provider-model-list { display:grid; gap:2px; max-height:220px; overflow:auto; padding:5px; border:1px solid #dbe5ea; border-radius:6px; background:#fff; }
.provider-model-choice { display:flex; align-items:center; gap:7px; min-height:30px; padding:3px 5px; border-radius:4px; color:#263442; font-size:11px; }
.provider-model-choice:hover { background:#f2fbfa; }
.provider-model-choice input { width:14px; height:14px; flex:0 0 auto; }
.provider-model-choice span { min-width:0; overflow-wrap:anywhere; }
.provider-model-empty { padding:8px; color:#64748b; font-size:11px; }
.provider-model-limit-row { display:grid; grid-template-columns:minmax(150px,1fr) 110px minmax(90px,110px); gap:7px; align-items:center; color:#526070; font-size:11px; }
.provider-model-limit, .provider-model-custom-limit { min-width:0; height:32px; padding:0 7px; border:1px solid #cbd3dc; border-radius:6px; background:#fff; }
.provider-model-actions { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.provider-model-status { font-size:10px; font-weight:700; color:#64748b; }
.provider-model-status.ready { color:#17636b; }
.provider-model-status.checking { color:#9a6810; }
.provider-model-status.active { color:#16824b; }
.provider-model-status.pending { color:#9a6810; }
.provider-model-status.inactive { color:#b43b3b; }
.provider-active-models { padding:7px 9px; border-left:3px solid #1b6f79; background:#f2fbfa; color:#526070; font-size:11px; line-height:1.4; }
.add-provider-model { display:block !important; width:100%; height:38px !important; margin-top:10px; border:1px dashed #1b6f79 !important; border-radius:7px !important; background:#f2fbfa !important; color:#17636b !important; font-weight:800 !important; cursor:pointer; }
.prov-summary::-webkit-details-marker { display: none; }
.prov-summary::before { content: "▶"; font-size: 10px; color: #6c7a89; transition: transform 140ms; }
details[open] .prov-summary::before { transform: rotate(90deg); }

.prov-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.prov-claude   { background: #d97706; }
.prov-gpt      { background: #10a37f; }
.prov-kimi     { background: #6366f1; }
.prov-deepseek { background: #0ea5e9; }
.prov-qwen     { background: #f43f5e; }

.prov-fields {
  display: grid;
  gap: 10px;
  padding: 4px 14px 14px;
}

.prov-bulk-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .provider-model-picker-row { grid-template-columns:1fr; }
  .provider-model-limit-row { grid-template-columns:1fr; }
}

/* ── image in feed ── */
.msg-img {
  margin-top: 8px;
  max-width: 260px;
  max-height: 200px;
  border-radius: 7px;
  object-fit: cover;
  display: block;
}

/* ── attachment chip with image preview ── */
.attachment-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #c8dfdc;
  border-radius: 7px;
  background: #edf7f6;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #1b6f79;
  overflow: hidden;
}
.attachment-chip.has-image {
  width: 136px;
  height: 68px;
  padding: 5px;
  background: #ffffff;
}
.attachment-chip img {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  object-fit: contain;
}
.chip-del {
  height: 16px; width: 16px;
  border: 0;
  border-radius: 50%;
  background: rgba(23,32,42,.15);
  color: #17202a;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.attachment-list .attachment-chip.has-image {
  width: min(260px, 48vw);
  height: 104px;
  padding: 6px 24px 6px 6px;
  background: #ffffff;
}

.attachment-list .attachment-chip.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #f7fafb;
}

.composer.has-attachments {
  flex-basis: 248px;
  height: 248px;
  min-height: 248px;
  max-height: 248px;
}

/* savings badge */
.savings-badge {
  font-size: 11px;
  color: #6c7a89;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.msg.assistant.thinking-msg .msg-thinking > .thinking-primary {
  order: 99;
  margin-top: 12px;
  padding-top: 8px;
  border-top: none;
}

.msg-thinking {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  gap: 8px;
  padding: 8px 2px;
  color: #6c7a89;
  font-size: 12px;
}

.thinking-dots {
  display: flex;
  gap: 5px;
}

.thinking-status {
  min-width: 0;
  color: #1b6f79;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Nunca ocultar la etiqueta de las bolitas: display:none + heartbeat
   provocaba titileo ("Trabajando Xs" aparece/desaparece). */
.thinking-status:empty::before {
  content: "Trabajando...";
  color: #1b6f79;
  font-weight: 600;
}
.thinking-status.is-streaming {
  opacity: 0.92;
}

.agent-narrative-entry.agent-narration.agent-stream-content {
  border-left-color: var(--ec-border-strong);
  color: var(--ec-text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.agent-live-activity {
  border-left-color: var(--ec-border) !important;
  color: var(--ec-text-muted) !important;
  font-style: italic;
}

.thinking-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: thinking-bounce 1.2s ease-in-out infinite;
}

/* Tras Keep All / fin de turno: bolitas quietas (no infinitas). */
.agent-execution-done .thinking-dots,
.agent-execution-done .thinking-primary {
  display: none !important;
}
.agent-execution-done .thinking-dots span {
  animation: none !important;
}

.thinking-dots span:nth-child(1) { background: #4285f4; }
.thinking-dots span:nth-child(2) { background: #ea4335; animation-delay: .2s; }
.thinking-dots span:nth-child(3) { background: #34a853; animation-delay: .4s; }

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.agent-execution-container {
  min-width: 0;
  border-top: none;
  margin-top: 10px;
  padding-top: 10px;
}

.msg-body .agent-execution-container {
  border-top: none;
  border-bottom: none;
  margin-top: 0;
  margin-bottom: 14px;
  padding-top: 0;
  padding-bottom: 14px;
}

.agent-narrative-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-narrative-entry {
  min-width: 0;
  border-left: none;
  padding-left: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: normal;
}

.agent-narrative-entry.is-error { color: #8f2732; }

.agent-narrative-entry.is-direction {
  color: #6c7a89;
  font-size: 11px;
  font-style: italic;
  background: transparent;
  padding-top: 2px;
  padding-bottom: 2px;
}

.agent-narrative-entry.is-model-wait,
.agent-narrative-entry.agent-live-activity {
  border-left: none;
  color: #6c7a89;
  font-size: 11px;
  background: transparent;
  padding-left: 0;
}

/* Narracion real del modelo: texto del agente, no burbuja de usuario */
.agent-narrative-entry.agent-narration {
  border-left: none;
  color: var(--ec-text);
  font-size: 13px;
  background: transparent;
  border-radius: 0;
  padding: 4px 0;
}
.agent-narrative-entry.agent-narration p { margin: 0 0 14px; line-height: 1.55; }
.agent-narrative-entry.agent-narration p:last-child { margin-bottom: 0; }
.agent-narrative-entry.agent-narration code { font-size: 12px; }

/* ── markdown alerts ── */
.msg-body blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  color: var(--ec-text);
  border-left: 4px solid var(--ec-border-strong);
  background-color: color-mix(in srgb, var(--ec-bg-soft) 60%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 4px;
}

.msg-body blockquote p {
  margin: 0;
}

.msg-body .markdown-alert {
  padding: 10px 16px;
  margin-bottom: 16px;
  border-left: 4px solid;
  border-radius: 6px;
}

.msg-body .markdown-alert-NOTE {
  border-left-color: #3b82f6;
  background-color: #eff6ff;
  color: #1e3a8a;
}

.msg-body .markdown-alert-TIP {
  border-left-color: #22c55e;
  background-color: #f0fdf4;
  color: #14532d;
}

.msg-body .markdown-alert-IMPORTANT {
  border-left-color: #a855f7;
  background-color: #faf5ff;
  color: #581c87;
}

.msg-body .markdown-alert-WARNING {
  border-left-color: #eab308;
  background-color: #fefce8;
  color: #713f12;
}

.msg-body .markdown-alert-CAUTION {
  border-left-color: #ef4444;
  background-color: #fef2f2;
  color: #7f1d1d;
}

/* ── markdown tables ── */
.msg-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
  color: var(--ec-text);
}

.msg-body th, .msg-body td {
  border: 1px solid var(--ec-border);
  padding: 6px 10px;
  text-align: left;
  color: var(--ec-text);
}

.msg-body th {
  background-color: color-mix(in srgb, var(--ec-bg-soft) 70%, transparent);
  font-weight: 700;
  color: var(--ec-text);
}

.msg-body tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--ec-bg-elevated) 45%, transparent);
}

.msg-streaming .msg-body::after {
  content: "▌";
  animation: blink .7s step-end infinite;
  color: var(--ec-accent);
  margin-left: 1px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* scrollbar thin */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd3dc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9aacba; }

/* modals container sits outside grid flow */
#modals {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
}
#modals dialog { pointer-events: auto; }

/* Tarjeta de autorización del agente */
.agent-approval-card {
  max-width: 92%;
  border: 1px solid #c5e3e6;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8feff 0%, #f1f8f9 100%);
  box-shadow: 0 10px 28px rgba(27, 111, 121, 0.12);
  overflow: hidden;
}

.agent-approval-card.is-approved {
  border-color: #9fd4b8;
  background: linear-gradient(180deg, #f6fff9 0%, #eef9f2 100%);
}

.agent-approval-card.is-denied {
  border-color: #e8b4b4;
  background: linear-gradient(180deg, #fff8f8 0%, #fdf1f1 100%);
}

.agent-approval-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
  color: #1b6f79;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.agent-approval-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #7ed0d8, #1b6f79);
  box-shadow: 0 0 0 3px rgba(27, 111, 121, 0.12);
  flex-shrink: 0;
}

.agent-approval-body {
  padding: 10px 16px 16px;
}

.agent-approval-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2d3a;
  line-height: 1.45;
}

.agent-approval-detail {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d7e8ea;
  background: #ffffff;
  color: #3d4f5f;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-approval-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.agent-diff-review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0 6px;
}

.agent-diff-file {
  border: 1px solid #d5e0e6;
  border-radius: 12px;
  background: #f8fbfc;
  padding: 10px 12px;
}

.agent-diff-file.is-accepted {
  border-color: #9fd0b0;
  background: #f1faf4;
}

.agent-diff-file.is-rejected {
  border-color: #e2b4b4;
  background: #fbf3f3;
}

.agent-diff-file-title {
  font-size: 13px;
  font-weight: 700;
  color: #2f4050;
  margin-bottom: 8px;
}

.agent-diff-hunk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.agent-diff-hunk {
  border: 1px solid #d7e2e8;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.agent-diff-hunk.is-accepted {
  border-color: #9fd0b0;
  background: #f1faf4;
}

.agent-diff-hunk.is-rejected {
  border-color: #e2b4b4;
  background: #fbf3f3;
}

.agent-diff-hunk-title {
  font-size: 11px;
  font-weight: 700;
  color: #526070;
  margin-bottom: 4px;
}

.agent-diff-review-bulk {
  margin-top: 10px;
}

.agent-diff-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 4px;
}
.agent-diff-status-badge.badge-accepted {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.agent-diff-status-badge.badge-rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.approval-btn {
  min-width: 120px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.approval-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.approval-btn-cancel {
  border: 1px solid #c8d5dc;
  background: #ffffff;
  color: #4a5b6a;
}

.approval-btn-cancel:hover:not(:disabled) {
  background: #f4f7f9;
  box-shadow: 0 4px 12px rgba(31, 45, 58, 0.08);
}

.approval-btn-approve {
  border: 1px solid #178a98;
  background: linear-gradient(180deg, #1f9aaa 0%, #157684 100%);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(21, 118, 132, 0.28);
}

.approval-btn-approve:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(21, 118, 132, 0.34);
}

/* ── Welcome / launcher (sigue el tema del IDE) ── */
.welcome-screen {
  position: fixed;
  top: 36px;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--ec-bg);
  color: var(--ec-text);
  overflow: auto;
}
.welcome-screen[hidden] {
  display: none !important;
}
body.welcome-open .app-toolbar,
body.welcome-open .app-statusbar {
  z-index: 250;
}
.welcome-inner {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.welcome-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.welcome-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 18px;
  background: transparent;
  image-rendering: auto;
}
.welcome-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ec-text);
}
.welcome-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--ec-text-muted);
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.welcome-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--ec-text);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  transition: border-color 0.12s ease, background 0.12s ease;
}
html[data-theme="blanco"] .welcome-action-card,
html[data-theme=""] .welcome-action-card {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.55) !important;
}
.welcome-action-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07) !important;
  box-shadow: none;
}
html[data-theme="blanco"] .welcome-action-card:hover,
html[data-theme=""] .welcome-action-card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.72) !important;
}
.welcome-action-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ec-accent);
  border: 0;
}
html[data-theme="blanco"] .welcome-action-icon,
html[data-theme=""] .welcome-action-icon {
  background: rgba(0, 0, 0, 0.04);
}
.welcome-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.welcome-action-text strong {
  font-size: 14px;
  font-weight: 650;
  color: var(--ec-text);
}
.welcome-action-text small {
  font-size: 12px;
  color: var(--ec-text-muted);
}
.welcome-recents {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.welcome-recents-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.welcome-recents-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--ec-text-muted);
  letter-spacing: 0.01em;
}
.welcome-link {
  border: 0;
  background: transparent;
  color: var(--ec-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.welcome-link:hover {
  text-decoration: underline;
}
.welcome-recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.welcome-recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ec-text);
  text-align: left;
  cursor: pointer;
}
.welcome-recent-row:hover {
  background: var(--ec-hover);
}
.welcome-recent-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ec-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.welcome-recent-path {
  font-size: 12px;
  color: var(--ec-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.welcome-recent-empty {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--ec-text-muted);
  text-align: center;
}
@media (max-width: 560px) {
  .welcome-recent-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .welcome-recent-path {
    text-align: left;
  }
}

/* ==========================================================================
   Modo de Voz Hands-Free / Dictado en Tiempo Real
   ========================================================================== */
.voice-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 4px;
}
.voice-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}
.voice-btn.active {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #ef4444 !important;
  animation: pulseVoice 1.5s infinite;
}
.voice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 99999;
}
@keyframes pulseVoice {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

/* Auto-collapse decided agent diff cards */
.agent-diff-file.is-decided:not(.is-expanded) .agent-approval-diff,
.agent-diff-file.is-decided:not(.is-expanded) .agent-diff-hunk-list {
  display: none !important;
}

.agent-diff-file.is-decided .agent-diff-file-title {
  cursor: pointer;
}

/* -- v2.9 IDE panels + ghost text -- */
.prompt-ghost-stack {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
}
.prompt-ghost-stack > * {
  grid-area: 1 / 1;
}
.prompt-ghost {
  margin: 0;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  color: transparent;
  pointer-events: none;
  overflow: hidden;
}
.prompt-ghost .ghost-suffix {
  color: #9aa7b5;
}
.prompt-ghost-stack textarea {
  background: transparent;
  position: relative;
  z-index: 1;
}

/* ── Terminal docked (mismo tema que EDITCOREAI) ── */
.viewer-terminal-split {
  height: 5px;
  cursor: ns-resize;
  background: var(--ec-border-strong);
  border-top: 1px solid var(--ec-border);
  border-bottom: 1px solid var(--ec-border);
}
.viewer-terminal-split.collapsed,
.viewer-terminal-split[hidden] {
  display: none;
}
.viewer-terminal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--ec-terminal-bg);
  color: var(--ec-terminal-text);
  border-top: 1px solid var(--ec-border);
  overflow: hidden;
}
.viewer-terminal.collapsed,
.viewer-terminal[hidden] {
  display: none;
}
.viewer-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  height: 32px;
  background: var(--ec-terminal-header);
  border-bottom: 1px solid var(--ec-border);
  flex-shrink: 0;
}
.viewer-terminal-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.viewer-terminal-tab {
  height: 26px;
  border: 0;
  border-bottom: 2px solid var(--ec-accent);
  background: transparent;
  color: var(--ec-terminal-text);
  font-size: 12px;
  font-weight: 600;
  padding: 0 10px;
  cursor: default;
}
.viewer-terminal-actions {
  display: flex;
  gap: 4px;
}
.viewer-terminal-actions button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--ec-border-strong);
  border-radius: 4px;
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  cursor: pointer;
  line-height: 1;
}
.viewer-terminal-actions button:hover {
  border-color: var(--ec-accent);
  color: var(--ec-accent);
}
.viewer-terminal .terminal-output {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--ec-terminal-bg);
  color: var(--ec-terminal-text);
  padding: 8px 10px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.45 ui-monospace, Consolas, "Cascadia Mono", monospace;
  outline: none;
  cursor: text;
  caret-color: var(--ec-accent);
}
.viewer-terminal .terminal-output:focus {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ec-accent) 45%, transparent);
}
.terminal-prompt-mark { color: var(--ec-accent); }

.toolbar-publish-btn,
.toolbar-connect-btn {
  font-weight: 600 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--ec-accent) !important;
}
.toolbar-publish-btn:hover,
.toolbar-connect-btn:hover {
  background: var(--ec-hover) !important;
  color: var(--ec-accent) !important;
}

/* Composer sigue flotante (no es panel inferior del viewer) */
.ide-side-panel {
  position: fixed;
  right: 12px;
  bottom: 150px;
  width: min(520px, 92vw);
  max-height: min(52vh, 520px);
  background: #0f1419;
  color: #d7e0ea;
  border: 1px solid #2a3644;
  border-radius: 10px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(0,0,0,.35);
  padding: 10px;
  gap: 8px;
}
.ide-side-panel.collapsed { display: none; }
.ide-side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ide-side-panel-actions { display: flex; gap: 6px; }
.ide-side-panel-actions.row { justify-content: flex-start; }
.ide-side-panel textarea,
.ide-side-panel input {
  width: 100%;
  background: #171e26;
  color: #e8eef5;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px;
  font: 12px/1.4 ui-monospace, Consolas, monospace;
}
.composer-diff-out {
  flex: 1;
  min-height: 140px;
  max-height: 280px;
  overflow: auto;
  background: #0b1015;
  border: 1px solid #243041;
  border-radius: 6px;
  padding: 8px;
  margin: 0;
  white-space: pre-wrap;
  font: 12px/1.4 ui-monospace, Consolas, monospace;
}
.toolbar-menu-sep {
  border: 0;
  border-top: 1px solid #d8dee6;
  margin: 4px 8px;
}
.publish-primary-action {
  font-weight: 650 !important;
  color: #0b4f57 !important;
}
.fullstack-progress {
  margin: 0 12px 8px;
  padding: 10px 12px;
  border: 1px solid #c9d6df;
  border-radius: 8px;
  background: #f4f8fa;
}
.fullstack-progress.hidden { display: none; }
.fullstack-progress-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.fullstack-progress-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #0f766e;
  min-width: 2.6em;
  text-align: right;
}
.fullstack-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #d8e4ea;
  overflow: hidden;
  margin-bottom: 10px;
}
.fullstack-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b6f79, #0ea5a8);
  transition: width 0.35s ease;
}
.fullstack-progress.is-error .fullstack-progress-fill {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
}
.fullstack-progress.is-done .fullstack-progress-fill {
  background: linear-gradient(90deg, #15803d, #22c55e);
}
.fullstack-progress-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.fullstack-progress-stages li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: start;
  font-size: 12px;
  color: #334155;
}
.fullstack-progress-stages li .mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  margin-top: 1px;
}
.fullstack-progress-stages li.is-pending .mark { background: #fff; }
.fullstack-progress-stages li.is-running .mark {
  border-color: #1b6f79;
  background: #d9eef1;
  animation: fullstackPulse 1s ease-in-out infinite;
}
.fullstack-progress-stages li.is-done .mark {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
}
.fullstack-progress-stages li.is-error .mark {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}
.fullstack-progress-stages li .meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.fullstack-progress-stages li .meta a { color: #0f766e; word-break: break-all; }
.fullstack-progress-stages li .stage-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: #64748b;
  min-width: 2.6em;
  text-align: right;
  margin-top: 1px;
}
.fullstack-progress-stages li.is-running .stage-pct { color: #0f766e; }
.fullstack-progress-stages li.is-done .stage-pct { color: #15803d; }
.fullstack-progress-stages li.is-error .stage-pct { color: #b91c1c; }
.fullstack-progress-stages li .stage-track {
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 2px;
}
.fullstack-progress-stages li .stage-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #94a3b8;
  transition: width 0.3s ease;
}
.fullstack-progress-stages li.is-running .stage-fill {
  background: linear-gradient(90deg, #1b6f79, #14b8a6);
}
.fullstack-progress-stages li.is-done .stage-fill {
  background: #16a34a;
}
.fullstack-progress-stages li.is-error .stage-fill {
  background: #dc2626;
}
@keyframes fullstackPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* -- Herramientas menu labels -- */
.toolbar-menu-label {
  padding: 6px 12px 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  user-select: none;
}
.toolbar-more-menu {
  min-width: 220px;
  max-height: min(70vh, 520px);
  overflow: auto;
}

/* Inspector: salud de proyectos (ex-Mantenimiento) */
.inspector-maintenance {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dde2e8;
}
.inspector-maintenance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.inspector-body {
  max-height: min(78vh, 820px);
  overflow: auto;
}

/* ── Theme surfaces: force chrome to follow tokens (gris Cursor / negro / azul) ── */
html[data-theme="gris"] .attachment-list,
html[data-theme="negro"] .attachment-list,
html[data-theme="azul"] .attachment-list {
  border-bottom-color: var(--ec-border);
  background: var(--ec-bg-soft);
}
html[data-theme="gris"] .chat-tab-close:hover,
html[data-theme="gris"] .chat-tab-new:hover,
html[data-theme="gris"] .chat-tab-trash:hover,
html[data-theme="gris"] .chat-tab-reload:hover,
html[data-theme="negro"] .chat-tab-close:hover,
html[data-theme="negro"] .chat-tab-new:hover,
html[data-theme="negro"] .chat-tab-trash:hover,
html[data-theme="negro"] .chat-tab-reload:hover,
html[data-theme="azul"] .chat-tab-close:hover,
html[data-theme="azul"] .chat-tab-new:hover,
html[data-theme="azul"] .chat-tab-trash:hover,
html[data-theme="azul"] .chat-tab-reload:hover {
  background: var(--ec-bg-soft);
  color: var(--ec-text);
}
html[data-theme="gris"] .file-item,
html[data-theme="negro"] .file-item,
html[data-theme="azul"] .file-item,
html[data-theme="gris"] .file-item.directory,
html[data-theme="negro"] .file-item.directory,
html[data-theme="azul"] .file-item.directory {
  color: #ffffff !important;
}
html[data-theme="gris"] .file-list-crumbs,
html[data-theme="negro"] .file-list-crumbs,
html[data-theme="azul"] .file-list-crumbs,
html[data-theme="gris"] .file-empty,
html[data-theme="negro"] .file-empty,
html[data-theme="azul"] .file-empty,
html[data-theme="gris"] .section-label,
html[data-theme="negro"] .section-label,
html[data-theme="azul"] .section-label,
html[data-theme="gris"] .project-path-label,
html[data-theme="negro"] .project-path-label,
html[data-theme="azul"] .project-path-label {
  color: #d0d0d0 !important;
}
html[data-theme="gris"] .file-item:hover,
html[data-theme="negro"] .file-item:hover,
html[data-theme="azul"] .file-item:hover {
  background: var(--ec-bg-soft);
  border-color: var(--ec-border-strong);
  color: #ffffff !important;
}
html[data-theme="gris"] .project-close-btn:hover:not(:disabled),
html[data-theme="negro"] .project-close-btn:hover:not(:disabled),
html[data-theme="azul"] .project-close-btn:hover:not(:disabled) {
  background: var(--ec-bg-soft);
}
html[data-theme="gris"] .composer-bar button:hover,
html[data-theme="negro"] .composer-bar button:hover,
html[data-theme="azul"] .composer-bar button:hover {
  color: var(--ec-accent);
  background: var(--ec-accent-soft);
}

/* Letras de botones Agente y Chat: Blanco puro en temas oscuros (negro, gris, azul), negro en tema blanco */
html[data-theme="gris"] #runMode,
html[data-theme="negro"] #runMode,
html[data-theme="azul"] #runMode,
html[data-theme="gris"] #runMode:hover,
html[data-theme="negro"] #runMode:hover,
html[data-theme="azul"] #runMode:hover,
html[data-theme="gris"] #runMode:focus,
html[data-theme="negro"] #runMode:focus,
html[data-theme="azul"] #runMode:focus,
html[data-theme="gris"] #openChatHomeBtn,
html[data-theme="negro"] #openChatHomeBtn,
html[data-theme="azul"] #openChatHomeBtn,
html[data-theme="gris"] .chat-home-nav-item,
html[data-theme="negro"] .chat-home-nav-item,
html[data-theme="azul"] .chat-home-nav-item,
html[data-theme="gris"] #chatHomeCrumb,
html[data-theme="negro"] #chatHomeCrumb,
html[data-theme="azul"] #chatHomeCrumb {
  color: #ffffff !important;
}

html[data-theme="gris"] #runMode option,
html[data-theme="negro"] #runMode option,
html[data-theme="azul"] #runMode option {
  background-color: #12151b !important;
  color: #ffffff !important;
}

html[data-theme="blanco"] #runMode,
html[data-theme="blanco"] #runMode:hover,
html[data-theme="blanco"] #openChatHomeBtn,
html[data-theme="blanco"] .chat-home-nav-item,
html[data-theme="blanco"] #chatHomeCrumb {
  color: #111827 !important;
}

html[data-theme="blanco"] #runMode option {
  background-color: #ffffff !important;
  color: #111827 !important;
}
html[data-theme="gris"] .chat-model-select,
html[data-theme="negro"] .chat-model-select,
html[data-theme="azul"] .chat-model-select,
html[data-theme="gris"] .composer-bar select,
html[data-theme="negro"] .composer-bar select,
html[data-theme="azul"] .composer-bar select {
  background: var(--ec-bg);
  color: var(--ec-text);
  border-color: var(--ec-border-strong);
}
html[data-theme="gris"] .permission-menu,
html[data-theme="negro"] .permission-menu,
html[data-theme="azul"] .permission-menu,
html[data-theme="gris"] .toolbar-more-menu,
html[data-theme="negro"] .toolbar-more-menu,
html[data-theme="azul"] .toolbar-more-menu {
  background: color-mix(in srgb, var(--ec-bg-elevated) 88%, transparent) !important;
  color: #ffffff !important;
  border-color: var(--ec-border-strong) !important;
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
html[data-theme="gris"] .toolbar-more-menu button,
html[data-theme="negro"] .toolbar-more-menu button,
html[data-theme="azul"] .toolbar-more-menu button,
html[data-theme="gris"] .toolbar-more-btn,
html[data-theme="negro"] .toolbar-more-btn,
html[data-theme="azul"] .toolbar-more-btn {
  color: var(--ec-text) !important;
  background: transparent !important;
  border: 0 !important;
}
html[data-theme="gris"] .toolbar-more-menu button:hover,
html[data-theme="negro"] .toolbar-more-menu button:hover,
html[data-theme="azul"] .toolbar-more-menu button:hover,
html[data-theme="gris"] .toolbar-more-btn:hover,
html[data-theme="negro"] .toolbar-more-btn:hover,
html[data-theme="azul"] .toolbar-more-btn:hover {
  background: var(--ec-hover) !important;
  color: var(--ec-text) !important;
}
html[data-theme="gris"] .permission-menu button strong,
html[data-theme="negro"] .permission-menu button strong,
html[data-theme="azul"] .permission-menu button strong {
  color: #ffffff !important;
}
html[data-theme="gris"] .permission-menu button span,
html[data-theme="negro"] .permission-menu button span,
html[data-theme="azul"] .permission-menu button span {
  color: color-mix(in srgb, #ffffff 72%, var(--ec-text-muted)) !important;
}
html[data-theme="gris"] .permission-menu button:hover,
html[data-theme="negro"] .permission-menu button:hover,
html[data-theme="azul"] .permission-menu button:hover {
  background: color-mix(in srgb, var(--ec-bg-soft) 70%, transparent) !important;
}
html[data-theme="gris"] .permission-menu button.is-active,
html[data-theme="negro"] .permission-menu button.is-active,
html[data-theme="azul"] .permission-menu button.is-active {
  background: color-mix(in srgb, var(--ec-accent-soft) 75%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--ec-accent) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ec-accent) 25%, transparent);
}
html[data-theme="gris"] .permission-menu button.is-active strong,
html[data-theme="negro"] .permission-menu button.is-active strong,
html[data-theme="azul"] .permission-menu button.is-active strong {
  color: #ffffff !important;
}
html[data-theme="gris"] .permission-menu button.is-active span,
html[data-theme="negro"] .permission-menu button.is-active span,
html[data-theme="azul"] .permission-menu button.is-active span {
  color: color-mix(in srgb, #ffffff 85%, var(--ec-accent)) !important;
}
html[data-theme="gris"] .msg.assistant .msg-head,
html[data-theme="negro"] .msg.assistant .msg-head,
html[data-theme="azul"] .msg.assistant .msg-head,
html[data-theme="gris"] .chat-status,
html[data-theme="negro"] .chat-status,
html[data-theme="azul"] .chat-status {
  color: var(--ec-accent);
}
html[data-theme="gris"] .msg-body hr,
html[data-theme="negro"] .msg-body hr,
html[data-theme="azul"] .msg-body hr {
  border-top-color: var(--ec-border);
}
html[data-theme="gris"] .brand-mark small,
html[data-theme="negro"] .brand-mark small,
html[data-theme="azul"] .brand-mark small,
html[data-theme="gris"] .toolbar-menu-label,
html[data-theme="negro"] .toolbar-menu-label,
html[data-theme="azul"] .toolbar-menu-label {
  color: var(--ec-text-muted);
}
html[data-theme="gris"] .viewer,
html[data-theme="negro"] .viewer,
html[data-theme="azul"] .viewer,
html[data-theme="gris"] aside,
html[data-theme="negro"] aside,
html[data-theme="azul"] aside,
html[data-theme="gris"] main,
html[data-theme="negro"] main,
html[data-theme="azul"] main,
html[data-theme="gris"] .app-toolbar,
html[data-theme="negro"] .app-toolbar,
html[data-theme="azul"] .app-toolbar {
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  border-color: var(--ec-border);
}
html[data-theme="gris"] main,
html[data-theme="negro"] main,
html[data-theme="azul"] main {
  background: var(--ec-bg);
}
html[data-theme="gris"] .viewer-body,
html[data-theme="negro"] .viewer-body,
html[data-theme="azul"] .viewer-body,
html[data-theme="gris"] .preview-webview,
html[data-theme="negro"] .preview-webview,
html[data-theme="azul"] .preview-webview,
html[data-theme="gris"] .preview-status,
html[data-theme="negro"] .preview-status,
html[data-theme="azul"] .preview-status,
html[data-theme="blanco"] .viewer-body,
html[data-theme="blanco"] .preview-webview,
html[data-theme="blanco"] .preview-status,
html[data-theme=""] .viewer-body,
html[data-theme=""] .preview-webview,
html[data-theme=""] .preview-status {
  background: var(--ec-preview-bg) !important;
  color: var(--ec-text-muted);
}


/* -- IDE: Monaco + Terminal + live hunks (complemento; no bajar z-index del editor) -- */
.monaco-editor-host {
  z-index: 5 !important;
}
.preview-webview.is-hidden-for-editor {
  visibility: hidden !important;
  pointer-events: none !important;
}
.agent-live-hunk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #0f172a;
  border-bottom: 1px solid #1f2937;
}
.agent-live-hunk {
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 8px;
  background: #111827;
}
.agent-live-hunk.is-accepted { border-color: #16a34a; }
.agent-live-hunk.is-rejected { border-color: #dc2626; opacity: 0.75; }
.agent-live-hunk-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.agent-live-hunk-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.agent-live-hunk-actions button {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.agent-hunk-accept { border-color: #16a34a !important; color: #86efac !important; }
.agent-hunk-reject { border-color: #dc2626 !important; color: #fca5a5 !important; }
.agent-live-hunk-preview {
  margin: 0;
  max-height: 120px;
  overflow: auto;
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cbd5e1;
  white-space: pre-wrap;
}
.agent-inline-diff-path {
  border: 0;
  background: transparent;
  color: #f8fafc;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.agent-inline-diff-path:hover { text-decoration: underline; }
.terminal-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 160px;
  background: #0b1220;
}
.terminal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #1e293b;
  color: #e2e8f0;
  font-size: 12px;
}
.terminal-backend {
  color: #64748b;
  font-size: 11px;
}
.terminal-toolbar button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 0;
  width: auto;
  height: auto;
  padding: 2px 6px;
  cursor: pointer;
}
.terminal-toolbar button:hover { color: #e2e8f0; }
.xterm-host {
  flex: 1 1 auto;
  min-height: 140px;
  padding: 4px 8px 8px;
}
#tab-terminal.logs-tab-content {
  display: none;
  height: 100%;
}
#tab-terminal.logs-tab-content.active,
#tab-terminal.logs-tab-content:not([hidden]) {
  display: block;
  height: 100%;
}

/* ── Status bar inferior (tipo Cursor) ── */
.app-statusbar {
  grid-column: 1 / -1;
  grid-row: 3;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  background: var(--ec-statusbar-bg);
  color: var(--ec-statusbar-text);
  border-top: 1px solid var(--ec-statusbar-border, var(--ec-border));
  font-size: 11px;
  font-weight: 500;
  line-height: 22px;
  z-index: 120;
  user-select: none;
  overflow: hidden;
}
.app-statusbar .statusbar-left,
.app-statusbar .statusbar-right {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}
.app-statusbar .statusbar-right {
  flex: 0 0 auto;
  margin-left: auto;
}
.app-statusbar .statusbar-item {
  display: inline-flex;
  align-items: center;
  max-width: 280px;
  padding: 0 8px;
  height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.95;
}
.app-statusbar .statusbar-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0 8px;
  height: 22px;
  border-radius: 0;
  box-shadow: none;
}
.app-statusbar .statusbar-btn:hover,
.app-statusbar .statusbar-item:hover {
  background: var(--ec-hover);
}
.app-statusbar .statusbar-sep {
  width: 1px;
  height: 12px;
  background: color-mix(in srgb, var(--ec-statusbar-text) 28%, transparent);
  flex: 0 0 auto;
}
.app-statusbar .statusbar-version {
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: none;
}

/* Bordes IDE más finos (tipo Cursor) en paneles clave */
aside,
.viewer,
.viewer-url,
.chat-tabs-bar,
.composer-shell,
.file-list {
  border-color: var(--ec-border) !important;
}
aside button,
.viewer-url button,
.chat-tabs-bar button,
.dlg-footer button.btn-outline,
.project-open-btn {
  border: 0 !important;
  box-shadow: none !important;
}
.project-open-btn {
  background: transparent !important;
  color: var(--ec-text-muted);
  border-radius: 0 !important;
}
.project-open-btn:hover {
  color: var(--ec-accent);
  background: var(--ec-hover) !important;
}

body.welcome-open .app-statusbar {
  opacity: 1;
  z-index: 250;
}

/* ==========================================================================
   EDITCOREAI MODERN 2-COLUMN SETTINGS & CREDITS / RBAC MODAL (ANTIGRAVITY STYLE)
   ========================================================================== */

.ec-settings-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ec-settings-sheet-overlay.is-open,
#chatHomeSettingsSheet.is-open {
  display: flex !important;
}

.ec-settings-modal-card {
  position: relative;
  width: min(920px, calc(100vw - 48px));
  height: min(640px, calc(100vh - 64px));
  display: flex;
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  border: 1px solid var(--ec-border);
  border-radius: 16px;
  box-shadow: 0 25px 60px var(--ec-shadow);
  overflow: hidden;
  animation: ecSettingsFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ecSettingsFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Sidebar izquierda */
.ec-settings-modal-sidebar {
  width: 260px;
  min-width: 240px;
  background: var(--ec-bg-soft);
  border-right: 1px solid var(--ec-border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 12px;
  box-sizing: border-box;
}

.ec-settings-search-wrap {
  width: 100%;
}

.ec-settings-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--ec-border-strong);
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  outline: none;
  transition: border-color 0.15s;
}

.ec-settings-search-input:focus {
  border-color: var(--ec-accent);
}

.ec-settings-section-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ec-text-muted);
  padding: 4px 8px 0;
  text-transform: uppercase;
}

.ec-settings-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.ec-settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ec-text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  width: 100%;
  box-sizing: border-box;
}

.ec-settings-nav-item:hover {
  background: var(--ec-hover);
}

.ec-settings-nav-item.is-active {
  background: var(--ec-accent-soft);
  color: var(--ec-accent);
  font-weight: 600;
}

.ec-settings-nav-icon {
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-settings-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-settings-pill-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--ec-accent);
  color: #fff;
}

.ec-settings-projects-box {
  background: var(--ec-bg-elevated);
  border: 1px solid var(--ec-border);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.ec-settings-project-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
}

.ec-proj-icon { font-size: 14px; }
.ec-proj-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Envoltorio Botón Cerrar Sesión */
.ec-settings-logout-wrap {
  margin-top: auto;
  margin-bottom: 8px;
}

/* Tarjeta Perfil de Usuario */
.ec-settings-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--ec-bg-elevated);
  border: 1px solid var(--ec-border);
  border-radius: 10px;
  margin-top: 0;
}

.ec-user-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0e639c, #4fc1ff);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ec-user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 1px;
}

.ec-user-display-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-user-email-addr {
  font-size: 11px;
  color: var(--ec-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-user-role-badge {
  font-size: 10px;
  font-weight: 700;
  color: #d97706;
  background: rgba(217, 119, 6, 0.12);
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 3px;
  width: fit-content;
}

/* Área de contenido principal */
.ec-settings-modal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--ec-bg-elevated);
  overflow: hidden;
}

.ec-settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 54px 16px 24px;
  border-bottom: 1px solid var(--ec-border);
}

.ec-settings-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.ec-settings-modal-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ec-text-muted);
}

.ec-settings-top-close {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 50;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  font-size: 16px;
  font-weight: 700;
  color: var(--ec-text-muted);
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}

.ec-settings-top-close:hover {
  background: var(--ec-hover) !important;
  color: var(--ec-text);
}

.ec-settings-content-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ec-settings-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ec-settings-pane.is-hidden,
.ec-settings-pane[hidden] {
  display: none !important;
}

/* Tarjetas y grupos */
.ec-settings-group-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--ec-bg);
  border: 1px solid var(--ec-border);
  border-radius: 12px;
  gap: 16px;
}

.ec-group-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.ec-group-info p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ec-text-muted);
}

.ec-styled-select {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--ec-border-strong);
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  outline: none;
  cursor: pointer;
}

.ec-styled-input {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--ec-border-strong);
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  outline: none;
  flex: 1;
}

.ec-styled-input:focus {
  border-color: var(--ec-accent);
}

/* Switches */
.ec-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.ec-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ec-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--ec-border-strong);
  transition: 0.2s;
  border-radius: 22px;
}

.ec-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.ec-switch input:checked + .ec-slider {
  background-color: var(--ec-accent);
}

.ec-switch input:checked + .ec-slider:before {
  transform: translateX(18px);
}

/* Segmented button group */
.ec-segmented-btn-group {
  display: flex;
  background: var(--ec-bg-soft);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.ec-seg-btn {
  border: none !important;
  background: transparent !important;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ec-text-muted);
  transition: background 0.12s, color 0.12s;
}

.ec-seg-btn.is-active {
  background: var(--ec-bg-elevated) !important;
  color: var(--ec-text) !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Theme picker cards */
.ec-theme-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.ec-theme-picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--ec-border) !important;
  background: var(--ec-bg-elevated) !important;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.ec-theme-picker-card:hover {
  border-color: var(--ec-accent) !important;
  transform: translateY(-2px);
}

.ec-theme-picker-card.is-active {
  border-color: var(--ec-accent) !important;
  outline: 2px solid var(--ec-accent);
  background: var(--ec-accent-soft) !important;
}

.ec-theme-thumb {
  width: 100%;
  height: 38px;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.ec-th-light { background: #f3f3f3; }
.ec-th-gray { background: #1e1e1e; }
.ec-th-black { background: #0d0d0d; }
.ec-th-blue { background: #0a1424; }

.ec-theme-picker-card strong { font-size: 13px; color: var(--ec-text); }
.ec-theme-picker-card small { font-size: 11px; color: var(--ec-text-muted); }

/* Créditos banner */
.ec-credits-overview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 99, 156, 0.15), rgba(79, 193, 255, 0.08));
  border: 1px solid rgba(14, 99, 156, 0.25);
}

.ec-credits-caption {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ec-accent);
}

.ec-credits-big-num {
  font-size: 32px;
  font-weight: 800;
  margin: 4px 0;
  color: var(--ec-text);
}

.ec-credits-plan-tag {
  font-size: 12px;
  color: var(--ec-text-muted);
}

.ec-btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none !important;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
}

.ec-btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.35);
}

.ec-voucher-redeem-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.ec-btn-action {
  background: var(--ec-accent) !important;
  color: #fff !important;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none !important;
  cursor: pointer;
}

.ec-btn-secondary {
  background: var(--ec-bg-soft) !important;
  color: var(--ec-text) !important;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--ec-border-strong) !important;
  cursor: pointer;
}

.ec-profile-edit-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.ec-input-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ec-input-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ec-text-muted);
}

.ec-status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}

.ec-tag-success {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.ec-status-msg {
  font-size: 12px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
}

/* Modal de Bloqueo por Créditos Agotados */
.ec-credits-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ec-credits-lock-overlay[hidden] {
  display: none !important;
}

.ec-credits-lock-card {
  position: relative;
  width: min(540px, calc(100vw - 32px));
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  border: 1px solid var(--ec-border);
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
  padding: 28px 24px;
  text-align: center;
  animation: ecSettingsFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ec-credits-lock-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent !important;
  border: none !important;
  font-size: 20px;
  color: var(--ec-text-muted);
  cursor: pointer;
}

.ec-credits-lock-icon {
  font-size: 42px;
  margin-bottom: 8px;
}

.ec-credits-lock-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.ec-credits-lock-card p {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--ec-text-muted);
  line-height: 1.5;
}

.ec-credits-packs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.ec-credits-pack-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 10px;
  border-radius: 12px;
  border: 1px solid var(--ec-border);
  background: var(--ec-bg);
  gap: 6px;
}

.ec-credits-pack-card.is-featured {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.ec-pack-tag {
  position: absolute;
  top: -9px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  background: #f59e0b;
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
}

.ec-pack-credits {
  font-size: 14px;
  font-weight: 700;
}

.ec-pack-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--ec-accent);
}

.ec-pack-btn {
  width: 100%;
  margin-top: 6px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--ec-border-strong) !important;
  background: var(--ec-bg-elevated) !important;
  color: var(--ec-text) !important;
  cursor: pointer;
}

.ec-pack-btn.is-featured {
  background: var(--ec-accent) !important;
  color: #fff !important;
  border: none !important;
}

.ec-credits-voucher-section {
  border-top: 1px solid var(--ec-border);
  padding-top: 16px;
  text-align: left;
}

.ec-credits-voucher-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.ec-payment-gateways-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
  text-align: left;
}

.ec-gateway-option {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ec-border);
  background: var(--ec-bg);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.ec-gateway-option:hover {
  border-color: var(--ec-accent);
  background: var(--ec-bg-soft);
}

.ec-gateway-option input[type="radio"] {
  display: none;
}

.ec-gateway-option.is-active,
.ec-gateway-option:has(input[type="radio"]:checked) {
  border-color: var(--ec-accent);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 1px var(--ec-accent);
}

.ec-gw-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--ec-text);
  margin-bottom: 2px;
}

.ec-gw-desc {
  font-size: 11px;
  color: var(--ec-text-muted);
  line-height: 1.2;
}

.ec-voucher-input-row {
  display: flex;
  gap: 8px;
}
