:root,
html[data-theme="dark"] {
  --bg-0: #0d1017;
  --bg-1: #0d1017;
  --bg-2: #151923;
  --bg-3: #1c2130;
  --bg-hover: #242a3c;
  --border: #222738;
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #e6edf3;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --accent: #7c5cff;
  --accent-hover: #9073ff;
  --accent-2: #a855f7;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.7);
  --bg-panel: #151923;
  --border-color: #222738;
}

html[data-theme="gray"] {
  --bg-0: #1e1e1e;
  --bg-1: #1e1e1e;
  --bg-2: #252526;
  --bg-3: #2d2d2d;
  --bg-hover: #37373d;
  --border: #333333;
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #cccccc;
  --text-dim: #999999;
  --text-mute: #6e7681;
  --accent: #8b6fff;
  --accent-hover: #9f87ff;
  --accent-2: #b366ff;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.7);
  --bg-panel: #252526;
  --border-color: #333333;
}

html[data-theme="light"] {
  --bg-0: #ffffff;
  --bg-1: #ffffff;
  --bg-2: #f1f5f9;
  --bg-3: #e2e8f0;
  --bg-hover: #cbd5e1;
  --border: #e2e8f0;
  --border-soft: rgba(0, 0, 0, 0.08);
  --text: #0f172a;
  --text-dim: #475569;
  --text-mute: #94a3b8;
  --accent: #6f42c1;
  --accent-hover: #8250df;
  --accent-2: #8957e5;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.15);
  --bg-panel: #f8fafc;
  --border-color: #e2e8f0;
}

* { box-sizing:border-box; margin:0; padding:0; }
html, body { height:100%; overflow:hidden; }

::-webkit-scrollbar { width:7px; height:7px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--bg-3); border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:var(--bg-hover); }

body {
  font-family:-apple-system,"Segoe UI Variable","Segoe UI","Inter",sans-serif;
  font-size:13px;
  background:var(--bg-0);
  color:var(--text);
  display:flex; flex-direction:column;
  height:100vh;
  -webkit-font-smoothing:antialiased;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height:42px; background:var(--bg-1);
  display:flex; align-items:center;
  padding:0 12px; gap:10px;
  flex-shrink:0;
  border-bottom:1px solid var(--border-soft);
}
.brand { display:flex; align-items:center; gap:8px; font-weight:600; font-size:13px; flex-shrink:0; cursor:default; }
.brand-logo {
  width: 20px;
  height: 23px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 0 8px rgba(124, 92, 255, 0.45));
  transition: transform 0.2s ease, filter 0.2s ease;
}
.brand:hover .brand-logo {
  transform: scale(1.08);
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.7));
}
.logo { color:var(--accent); font-size:14px; text-shadow:0 0 10px rgba(124,92,255,0.5); }
.brand b, .brand-text { color:var(--text) !important; font-weight:600; letter-spacing:0.2px; }
.version-tag {
  font-size:10px;
  padding:2px 7px;
  background:rgba(124,92,255,0.2);
  color:#a855f7;
  border:1px solid rgba(124,92,255,0.45);
  border-radius:12px;
  margin-left:4px;
  font-weight:700;
  letter-spacing:0.4px;
}

.toolbar {
  display:flex;
  align-items:center;
  gap:4px;
  flex:1;
  overflow-x:auto;
  overflow-y:hidden;
  min-width:0;
  padding-right:4px;
}
.toolbar::-webkit-scrollbar { height:3px; }
.toolbar select {
  background:var(--bg-2); color:var(--text);
  border:1px solid var(--border-soft); padding:5px 8px;
  border-radius:var(--radius);
  font-size:11.5px; font-family:inherit;
  width:160px; max-width:160px; flex:0 0 160px;
  cursor:pointer;
  outline:none;
  transition:all .15s ease;
}
.toolbar select:hover { background:var(--bg-3); border-color:rgba(124,92,255,0.4); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.dropdown-wrap {
  position: relative;
  display: inline-block;
}
.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover {
  background: var(--bg-3);
  color: #ffffff;
  border-color: rgba(124,92,255,0.4);
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 270px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.5);
  padding: 6px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInDown 0.15s ease-out;
}
.dropdown-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 10px 4px;
  letter-spacing: 0.5px;
}
.dropdown-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 4px 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.dropdown-item:hover {
  background: var(--bg-2);
  color: #ffffff;
}
.dd-icon {
  font-size: 14px;
  width: 18px;
  display: inline-flex;
  justify-content: center;
}
.badge-mini {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(239,68,68,0.2);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.35);
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  background:transparent; color:var(--text);
  border:none; padding:6px 10px;
  border-radius:var(--radius);
  cursor:pointer; font-size:12px;
  font-family:inherit;
  transition:all .15s ease;
  display:inline-flex; align-items:center; gap:5px;
  white-space:nowrap; flex-shrink:0;
}
.btn:hover { background:var(--bg-2); color:#fff; }
.btn:active { background:var(--bg-3); transform:scale(0.98); }
.btn.primary {
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#fff;
  font-weight:600;
  box-shadow:0 2px 8px rgba(124,92,255,0.25);
}
.btn.primary:hover { background:linear-gradient(135deg, var(--accent-hover), #b366ff); box-shadow:0 4px 12px rgba(124,92,255,0.45); }
.btn.ghost { background:transparent; }
.btn.ghost:hover { background:rgba(255,255,255,0.06); }
.btn.small { padding:4px 8px; font-size:11px; border-radius:6px; }
.btn[disabled] { opacity:.5; cursor:not-allowed; }

.mode-toggle {
  display:flex; align-items:center; gap:5px;
  background:var(--bg-2); border:1px solid var(--border-soft);
  color:var(--text-dim);
  padding:5px 12px; border-radius:999px;
  cursor:pointer; font-size:12px;
  font-weight:500; font-family:inherit;
  flex-shrink:0;
  transition:all .15s ease;
}
.mode-toggle:hover { background:var(--bg-3); color:var(--text); }
.mode-toggle.agent-mode {
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#fff;
  border-color:transparent;
  box-shadow:0 2px 10px rgba(124,92,255,0.35);
}

.layout {
  flex:1; display:grid;
  grid-template-columns:380px 1fr 280px;
  gap:1px; background:var(--bg-0);
  min-height:0;
}
.panel { background:var(--bg-1); display:flex; flex-direction:column; min-height:0; }
.panel-head {
  height:35px; padding:0 12px;
  display:flex; align-items:center;
  justify-content:space-between;
  background:var(--bg-1); flex-shrink:0;
  border-bottom:1px solid var(--border-soft);
}
.panel-head h3 {
  font-size:11px; color:var(--text-mute);
  text-transform:uppercase;
  letter-spacing:.6px; font-weight:600;
}

.tabs { display:flex; gap:3px; }
.tab {
  background:transparent; border:none;
  color:var(--text-dim);
  padding:5px 10px; cursor:pointer;
  font-size:12px; border-radius:6px;
  font-family:inherit;
  transition:all .15s ease;
}
.tab:hover { background:rgba(255,255,255,0.06); color:var(--text); }
.tab.active { background:var(--bg-3); color:#fff; font-weight:500; box-shadow:0 1px 4px rgba(0,0,0,0.2); }

.chat-log {
  flex:1; overflow-y:auto; padding:12px 14px 30px;
  display:flex; flex-direction:column; gap:10px;
}
.msg { padding:6px 0; }
.msg .who {
  font-size:10px; color:var(--text-mute);
  text-transform:uppercase; margin-bottom:4px;
  font-weight:600; letter-spacing:.5px;
}
.msg.user .who { color:var(--accent); }
.msg.assistant .who { color:var(--accent-2); }
.msg.system .who { color:var(--warn); }
.msg .body {
  white-space: normal;
  line-height: 1.6;
  font-size: 13.5px;
  word-break: break-word;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: #e2e8f0;
}
.msg.user .body {
  white-space: pre-wrap;
}
.msg .body p.md-p {
  margin: 6px 0 8px;
  line-height: 1.6;
}
.msg .body h1, .msg .body h2.md-h1 {
  font-size: 15px; font-weight: 700; color: #f8fafc;
  margin: 14px 0 6px; padding-bottom: 3px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.msg .body h3.md-h2 {
  font-size: 14px; font-weight: 600; color: #f8fafc;
  margin: 12px 0 5px;
}
.msg .body h4.md-h3 {
  font-size: 13px; font-weight: 600; color: var(--accent, #818cf8);
  margin: 10px 0 4px;
}
.msg .body h5.md-h4 {
  font-size: 12.5px; font-weight: 600; color: #cbd5e1;
  margin: 8px 0 4px;
}
.msg .body ul.md-ul, .msg .body ol.md-ol {
  margin: 6px 0 10px;
  padding-left: 20px;
}
.msg .body li {
  margin-bottom: 4px;
  line-height: 1.55;
}
.msg .body blockquote.md-quote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent, #7c5cff);
  background: rgba(124, 92, 255, 0.08);
  border-radius: 0 6px 6px 0;
  color: #cbd5e1;
}
.msg .body hr.md-hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 12px 0;
}
.msg .body code.md-inline-code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #f0abfc;
}
.md-code-wrap {
  margin: 8px 0 10px;
  border-radius: 8px;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.md-code-lang {
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 10px;
  font-size: 10.5px;
  font-family: Consolas, monospace;
  color: var(--text-mute, #94a3b8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-transform: uppercase;
}
.md-code-wrap pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12.5px;
}
.md-code-wrap code {
  font-family: Consolas, monospace;
  color: #e2e8f0;
  background: transparent !important;
  padding: 0 !important;
}

.md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 10px 0;
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.md-table th, .md-table td {
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 7px 11px;
  text-align: left;
}
.md-table th {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  color: #f8fafc;
}
.md-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.tree-node.agent-active-file {
  background: rgba(124, 92, 255, 0.2) !important;
  color: #c084fc !important;
  font-weight: 600 !important;
  border-left: 2px solid #a855f7;
}
.agent-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a855f7;
  margin-left: 6px;
  vertical-align: middle;
  box-shadow: 0 0 4px rgba(168, 85, 247, 0.5);
}
.agent-dot.write {
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
}

.chat-input-wrap {
  background: transparent;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
  border-top: none;
}

.chat-input-capsule {
  background: var(--bg-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 8px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.chat-input-capsule:focus-within {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.16), 0 8px 28px rgba(0, 0, 0, 0.45);
  background: #181c29;
}

.chat-input-capsule textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 4px 4px 2px;
  resize: none;
  min-height: 50px;
  max-height: 180px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
}

.chat-input-capsule textarea::placeholder {
  color: var(--text-mute);
  opacity: 0.8;
}

.chat-capsule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-mute);
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.tool-hint {
  font-size: 10.5px;
  color: var(--text-mute);
  margin-left: 6px;
}

.tool-hint.agent-active {
  color: var(--accent-2);
  font-weight: 600;
}

/* ============================================================
   Selector de Permisos en el Footer del Chat
   ============================================================ */
.chat-perm-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  margin-right: 6px;
}

.chat-perm-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim, #94a3b8);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
  user-select: none;
  height: 28px;
}

.chat-perm-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  border-color: rgba(255, 255, 255, 0.22);
}

.chat-perm-btn.mode-full {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.chat-perm-btn.mode-full:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.55);
}

.chat-perm-btn.mode-ask {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.chat-perm-btn.mode-ask:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.55);
}

.chat-perm-btn.mode-readonly {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}
.chat-perm-btn.mode-readonly:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.55);
}

.chat-perm-icon {
  font-size: 12px;
  line-height: 1;
}

.chat-perm-label {
  font-size: 11px;
  font-weight: 600;
}

.chat-perm-chevron {
  font-size: 9px;
  opacity: 0.7;
  margin-left: 1px;
}

.chat-perm-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: var(--bg-1, #161b22);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  padding: 6px;
  z-index: 1000;
  backdrop-filter: blur(16px);
}

.chat-perm-dropdown.hidden {
  display: none !important;
}

.perm-dropdown-header {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-mute, #8b949e);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px 4px;
}

.perm-option-item {
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.perm-option-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.perm-option-item.active {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
}

.perm-opt-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #f0f6fc);
}

.perm-opt-check {
  margin-left: auto;
  color: #38bdf8;
  font-size: 12px;
  display: none;
}

.perm-option-item.active .perm-opt-check {
  display: inline-block;
}

.perm-opt-desc {
  font-size: 10.5px;
  color: var(--text-dim, #8b949e);
  margin-top: 3px;
  line-height: 1.35;
}

.send-btn {
  padding: 5px 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  height: 30px !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.35);
  transition: all 0.15s ease;
}

.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.5);
}

.slash-menu {
  position:absolute; bottom:100%;
  left:12px; right:12px; margin-bottom:8px;
  background:var(--bg-2); border:1px solid var(--border-soft); border-radius:var(--radius);
  max-height:240px; overflow-y:auto;
  z-index:50; box-shadow:var(--shadow-lg);
  padding:6px;
}
.slash-item {
  display:flex; align-items:center; gap:12px;
  padding:8px 10px; cursor:pointer;
  font-size:12px; border-radius:6px;
  transition:background .12s;
}
.slash-item:hover { background:var(--bg-hover); }
.slash-item b {
  color:var(--accent);
  font-family:Consolas,monospace;
  min-width:75px; font-size:11.5px;
}
.slash-item span { color:var(--text-dim); font-size:11.5px; }

.attach-preview {
  display:flex; flex-wrap:wrap; gap:6px;
  padding:4px 2px 6px; max-height:140px; overflow-y:auto;
}
.attach-chip {
  display:flex; align-items:center; gap:6px;
  background:var(--bg-3); border-radius:6px;
  padding:4px 8px; font-size:11px; max-width:220px;
  border:1px solid rgba(255,255,255,0.06);
}
.attach-chip .ac-icon { font-size:13px; }
.attach-chip .ac-name {
  white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; max-width:130px;
  font-family:Consolas,monospace;
}
.attach-chip .ac-remove {
  background:transparent; border:none;
  color:var(--text-dim); cursor:pointer;
  font-size:14px; padding:0 4px;
}
.attach-chip .ac-remove:hover { color:var(--err); }
.attach-chip.image .ac-thumb {
  width:30px; height:30px;
  object-fit:cover; border-radius:4px;
}
.chat-input textarea::placeholder { color:var(--text-mute); }
.chat-input textarea:focus { background:var(--bg-hover); }
.chat-input textarea.dragover { background:rgba(78,201,160,.08); }

.panel-center .panel-head { justify-content:space-between; }
.view { flex:1; display:none; position:relative; min-height:0; }
.view.active { display:flex; flex-direction:column; }
#monaco, #monaco-diff { flex:1; min-height:0; }

.browser-bar {
  display:flex; align-items:center; gap:6px;
  padding:8px 12px; background:var(--bg-1);
  border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.browser-bar input {
  flex:1; background:var(--bg-2); border:1px solid var(--border);
  color:var(--text); padding:7px 12px;
  border-radius:var(--radius); font-size:12px;
  outline:none;
}
.browser-bar input:focus {
  border-color:var(--accent);
}
.browser-bar .br-reload {
  font-size:16px; line-height:1;
  padding:4px 8px; flex-shrink:0;
}
.browser-viewport {
  flex:1;
  display:flex;
  width:100%;
  height:100%;
  min-height:0;
  position:relative;
  overflow:hidden;
  background:#ffffff;
  transition:all 0.2s ease;
}
.browser-viewport.responsive-mode {
  background:#090d16;
  align-items:center;
  justify-content:center;
  padding:24px;
  overflow:auto;
}
.browser-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899, #6366f1);
  background-size: 200% 100%;
  animation: br-loading-anim 1.2s linear infinite;
  z-index: 10;
  display: block;
}
.browser-loading-bar.hidden {
  display: none !important;
}
@keyframes br-loading-anim {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
#browser-frame {
  width:100%;
  height:100%;
  min-height:100%;
  flex:1;
  border:none;
  background:#ffffff;
  transition:width 0.25s ease, height 0.25s ease, border-radius 0.25s ease, box-shadow 0.25s ease;
}
.diff-toolbar {
  display:flex; justify-content:space-between;
  align-items:center; padding:8px 14px;
  background:var(--bg-1); font-size:12px;
}

.terminal-toolbar {
  height:34px; padding:0 12px;
  display:flex; align-items:center;
  justify-content:space-between;
  background:var(--bg-1);
  font-size:11px; color:var(--text-mute);
  letter-spacing:.5px; flex-shrink:0;
}
.terminal-tabs { display:flex; gap:2px; }
.terminal-tab {
  background:transparent; border:none;
  color:var(--text-dim); padding:5px 12px;
  border-radius:var(--radius-sm);
  cursor:pointer; font-size:11.5px;
  font-family:inherit;
}
.terminal-tab:hover { background:var(--bg-2); color:var(--text); }
.terminal-tab.active { background:var(--bg-3); color:var(--text); }
.terminal-body { flex:1; position:relative; min-height:0; background:var(--bg-0); }
.terminal-panel { position:absolute; inset:0; display:none; }
.terminal-panel.active { display:block; }
#terminal { position:absolute; inset:0; padding:8px 12px; }
#terminal-fallback {
  position:absolute; inset:0; overflow-y:auto;
  padding:10px 14px;
  font-family:Consolas,monospace; font-size:11.5px;
  line-height:1.65; color:var(--text);
}
#terminal-shell { position:absolute; inset:0; padding:4px 6px; }

.file-tree { flex:1; overflow-y:auto; padding:6px 0; font-size:12.5px; }
.tree-node {
  padding:5px 12px; cursor:pointer;
  border-radius:4px; margin:1px 6px;
  white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis;
  display:flex; align-items:center; gap:6px;
}
.tree-node:hover { background:var(--bg-2); }
.tree-node.file:hover { color:var(--accent); }
.tree-node.project-file { color:var(--accent-2); }
.tree-node.dir { color:var(--text); font-weight:500; }

.modal {
  position:fixed; inset:0;
  background:rgba(0,0,0,.75);
  backdrop-filter:blur(4px);
  display:flex; align-items:center;
  justify-content:center; z-index:1000;
}
.modal.hidden { display:none !important; }

.modal-box {
  background:var(--bg-1); border-radius:14px;
  width:560px; max-height:82vh;
  overflow-y:auto; padding:24px;
  box-shadow:var(--shadow-lg);
}
.modal-box.small { width:440px; }
.modal-head {
  display:flex; justify-content:space-between;
  align-items:center; margin-bottom:20px;
}
.modal-head h2 { font-size:15px; font-weight:600; }

label {
  display:block; margin:12px 0 6px;
  font-size:11px; color:var(--text-mute);
  text-transform:uppercase; letter-spacing:.4px;
  font-weight:600;
}
input, textarea, select {
  width:100%; background:var(--bg-2); border:none;
  color:var(--text); border-radius:var(--radius);
  padding:9px 12px; font-size:13px;
  font-family:inherit; outline:none;
}
input:focus, select:focus, textarea:focus { background:var(--bg-hover); }
.row { display:flex; gap:8px; margin-top:14px; }
.git-log {
  margin-top:12px; font-family:Consolas,monospace;
  font-size:11px; color:var(--text-dim);
  max-height:140px; overflow-y:auto;
  line-height:1.6; padding:8px 10px;
  background:var(--bg-2); border-radius:6px;
}
.hidden { display:none !important; }
.hint { font-size:11.5px; color:var(--text-dim); line-height:1.5; margin-top:6px; }

#providers-full-list { display:flex; flex-direction:column; gap:18px; margin-top:16px; }
.provider-block { background:var(--bg-2); border-radius:10px; overflow:hidden; }
.provider-block-head {
  padding:12px 16px; background:var(--bg-3);
  display:flex; justify-content:space-between; align-items:center;
}
.provider-block-head b { font-size:14px; }
.provider-block-head .pb-url {
  font-size:11px; color:var(--text-mute);
  font-family:Consolas,monospace; margin-top:3px;
}
.provider-block-head .pb-count { font-size:11px; color:var(--ok); font-weight:600; }

.group-row { padding:14px 16px; border-bottom:1px solid var(--border-soft); }
.group-row:last-child { border-bottom:none; }
.group-header { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.group-icon { font-size:14px; }
.group-name { font-weight:600; font-size:13px; }
.group-count { font-size:11px; color:var(--text-dim); margin-left:auto; }
.group-badge { font-size:10.5px; padding:3px 8px; border-radius:10px; font-family:Consolas,monospace; }
.group-badge.ok { background:rgba(78,201,160,.15); color:var(--ok); }
.group-badge.off { background:rgba(239,90,90,.15); color:var(--err); }
.group-key-row { display:flex; gap:8px; margin-bottom:10px; }
.group-key-input {
  flex:1; background:var(--bg-1); border:none;
  color:var(--text); border-radius:6px;
  padding:8px 12px; font-size:12px;
  font-family:Consolas,monospace; outline:none;
}
.group-key-input:focus { background:var(--bg-3); }
.group-models-chips { display:flex; flex-wrap:wrap; gap:4px; }
.model-chip {
  font-size:10.5px; padding:3px 8px;
  background:var(--bg-3); color:var(--text-dim);
  border-radius:4px; font-family:Consolas,monospace;
}

.account-card {
  display:flex; align-items:center; gap:12px;
  background:var(--bg-2); border-radius:10px;
  padding:14px; margin-bottom:10px;
}
.account-avatar {
  width:42px; height:42px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  display:flex; align-items:center; justify-content:center;
  font-size:20px; flex-shrink:0;
}
.account-name { font-weight:600; font-size:13px; }
.account-meta { font-size:11.5px; color:var(--text-dim); margin-top:3px; }
.account-card .btn { margin-left:auto; }
.repos-list { margin-top:10px; max-height:320px; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.repo-item {
  display:flex; align-items:center; justify-content:space-between;
  background:var(--bg-2); border-radius:8px;
  padding:10px 12px; font-size:12.5px;
  cursor:pointer;
}
.repo-item:hover { background:var(--bg-hover); }
.repo-item.selected { background:rgba(78,201,160,.1); }
.repo-item .ri-name { font-weight:500; }
.repo-item .ri-meta { font-size:10.5px; color:var(--text-dim); margin-top:3px; }
.repo-item .ri-badge { font-size:10.5px; padding:3px 8px; border-radius:6px; background:var(--bg-3); color:var(--text-dim); }
.repo-empty { padding:24px; text-align:center; color:var(--text-mute); font-size:12px; }

.conn-section { background:var(--bg-2); border-radius:10px; margin-bottom:12px; overflow:hidden; }
.conn-head { padding:12px 16px; display:flex; align-items:center; gap:10px; background:var(--bg-3); }
.conn-icon { font-size:16px; }
.conn-name { font-weight:600; font-size:13px; }
.conn-status { margin-left:auto; font-size:11px; color:var(--text-mute); font-family:Consolas,monospace; }
.conn-body { padding:14px 16px; }

.disk-bar, .repo-bar {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 12px; background:var(--bg-2); font-size:11.5px;
}
.disk-up-btn {
  display:inline-flex; align-items:center; justify-content:center;
  width:18px; height:18px; margin:0 4px; padding:0;
  background:transparent; border:none; border-radius:4px;
  color:var(--text-dim, #94a3b8); cursor:pointer; vertical-align:middle;
}
#btn-update.update-available {
  color:#fff; background:linear-gradient(135deg,#10b981,#059669);
  border-color:transparent; font-weight:600;
}
.disk-up-btn:hover { background:rgba(255,255,255,0.08); color:var(--text, #e2e8f0); }
.disk-label, .repo-name {
  font-family:Consolas,monospace; color:var(--ok);
  display:flex; align-items:center; gap:6px; min-width:0;
}
.disk-label b, .repo-name {
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.repo-name { color:var(--accent); }

.project-bar {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 12px; background:rgba(166,115,255,.08);
  font-size:11.5px; color:var(--accent-2);
}
.project-label b { color:#fff; }

.pending-bar { padding:10px 12px; background:rgba(240,165,69,.06); }
.pending-head {
  display:flex; align-items:center; gap:10px;
  font-size:11.5px; color:var(--warn);
  margin-bottom:8px; font-weight:600;
}
.pending-head .btn { margin-left:auto; }
.pending-list { display:flex; flex-direction:column; gap:4px; max-height:200px; overflow-y:auto; }
.pending-item {
  display:flex; align-items:center; gap:8px;
  background:var(--bg-2); border-radius:6px;
  padding:6px 10px; font-size:11.5px;
}
.pending-item .pi-name {
  flex:1; font-family:Consolas,monospace;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.pending-item .pi-actions { display:flex; gap:3px; }
.pending-item .pi-btn {
  background:transparent; border:none;
  color:var(--text-dim); width:24px; height:24px;
  border-radius:5px; cursor:pointer; font-size:12px;
}
.pending-item .pi-btn:hover { background:var(--bg-hover); }
.pending-item .pi-btn.pi-accept { color:var(--ok); }
.pending-item .pi-btn.pi-reject { color:var(--err); }

.dot { width:7px; height:7px; border-radius:50%; background:var(--ok); flex-shrink:0; }
.dot.off { background:var(--err); }
.rag-status, .lsp-status {
  font-size:10.5px; padding:3px 9px; border-radius:10px;
  background:rgba(78,201,160,.12);
  color:var(--ok); font-family:Consolas,monospace; font-weight:600;
}

.mentions-dropdown {
  position:fixed; z-index:2000;
  background:var(--bg-2); border-radius:10px;
  box-shadow:var(--shadow); max-height:320px;
  overflow-y:auto; padding:6px;
}
.mentions-dropdown.hidden { display:none; }
.mention-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:6px;
  cursor:pointer; font-size:12.5px;
}
.mention-item.selected { background:rgba(166,115,255,.18); }
.mention-item:hover { background:var(--bg-hover); }
.mention-item .mi-label {
  font-family:Consolas,monospace; flex:1;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.mention-item .mi-hint { font-size:10.5px; color:var(--text-dim); }

.lsp-server-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 14px; background:var(--bg-2);
  border-radius:8px; margin-bottom:6px;
  font-size:12.5px;
}
.lsp-server-item.active { background:rgba(78,201,160,.08); }
.lsp-server-item .lsi-icon { font-size:16px; }
.lsp-server-item .lsi-name { flex:1; font-weight:500; }
.lsp-server-item .lsi-status {
  font-size:10.5px; padding:3px 8px;
  border-radius:10px; background:var(--bg-3);
  color:var(--text-dim); font-family:Consolas,monospace;
}
.lsp-server-item.active .lsi-status { background:rgba(78,201,160,.15); color:var(--ok); }
.lsp-server-item .lsi-btn {
  background:var(--bg-3); color:var(--text);
  border:none; padding:5px 12px;
  border-radius:6px; cursor:pointer;
  font-size:11px; font-family:inherit;
}
.lsp-server-item .lsi-btn:hover { background:var(--bg-hover); }

.inline-edit-overlay {
  position:fixed; z-index:9999;
  background:var(--bg-1); border-radius:10px;
  padding:14px 16px; box-shadow:var(--shadow-lg);
  min-width:400px;
}
.inline-edit-header {
  display:flex; align-items:center; gap:8px;
  margin-bottom:12px; font-size:12.5px;
  font-weight:600; color:var(--accent-2);
}
.inline-edit-header .ie-title { flex:1; }
.inline-edit-header .ie-close {
  background:transparent; border:none;
  color:var(--text-dim); font-size:18px;
  cursor:pointer;
}
.inline-edit-overlay .ie-input {
  background:var(--bg-2); border:none;
  color:var(--text); padding:10px 12px;
  border-radius:6px; font-size:13px;
  width:100%; outline:none; font-family:inherit;
}
.inline-edit-hints {
  display:flex; gap:12px; margin-top:10px;
  font-size:10.5px; color:var(--text-mute);
}
.inline-edit-hints b {
  color:var(--text); background:var(--bg-3);
  padding:2px 6px; border-radius:3px;
  font-size:10px;
}

#modal-custom { z-index:3000; }
#modal-custom .modal-box { width:400px; padding:22px 24px; }
#modal-custom .custom-message {
  font-size:13.5px; line-height:1.6;
  color:var(--text); margin-bottom:6px;
  white-space:pre-wrap;
}
#modal-custom .custom-input { margin-top:12px; }
#modal-custom .custom-detail {
  max-height:240px; overflow:auto;
  margin-top:10px; padding:10px;
  background:rgba(0,0,0,.35); border-radius:6px;
  font-family:ui-monospace, Consolas, monospace; font-size:12px;
  white-space:pre-wrap; word-break:break-all;
}
#modal-custom .custom-actions {
  display:flex; gap:8px;
  justify-content:flex-end; margin-top:20px;
}

.resp-toolbar {
  display:flex; gap:2px; margin-left:8px; padding:2px;
  background:var(--bg-2); border-radius:6px;
}
.resp-btn {
  background:transparent; border:none;
  color:var(--text-dim); padding:5px 10px;
  border-radius:4px; cursor:pointer;
  font-size:14px; line-height:1;
}
.resp-btn:hover { background:var(--bg-3); color:var(--text); }
.resp-btn.active { background:var(--accent); color:#fff; }

.tpl-item { transition:all .15s; }
.tpl-item:active { transform:scale(.98); }

.tree-node .file-status {
  display:inline-block; width:8px; height:8px;
  border-radius:50%; margin-right:6px;
  flex-shrink:0; background:transparent;
}
.tree-node.live-working { background:rgba(240,165,69,.12) !important; }
.tree-node.live-working .file-status {
  background:var(--warn);
  box-shadow:0 0 4px rgba(240,165,69,.6);
}
.tree-node.live-done { background:rgba(78,201,160,.06) !important; }
.tree-node.live-done .file-status { background:var(--ok); }
.tree-node.live-error { background:rgba(239,90,90,.1) !important; }
.tree-node.live-error .file-status { background:var(--err); }
.tree-node.live-pending .file-status { background:var(--accent-2); }

.live-view { display:flex; flex-direction:column; height:100%; background:var(--bg-1); }
.live-header {
  padding:16px 20px; background:var(--bg-1);
  border-bottom:1px solid var(--border-soft);
  flex-shrink:0;
}
.live-phase { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.live-phase-icon { font-size:18px; }
.live-phase-title { font-size:14px; font-weight:700; }
.live-phase-sub {
  font-size:11.5px; color:var(--text-dim);
  margin-left:auto; font-family:Consolas,monospace;
}
.live-agents { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.live-agent-chip {
  display:flex; align-items:center; gap:6px;
  padding:5px 10px; background:var(--bg-2);
  border-radius:20px; font-size:11.5px;
}
.live-agent-chip.running { background:rgba(91,124,250,.12); color:var(--accent); }
.live-agent-chip.done { background:rgba(78,201,160,.1); color:var(--ok); }
.live-agent-chip.error { background:rgba(239,90,90,.1); color:var(--err); }
.live-progress {
  height:4px; background:var(--bg-3);
  border-radius:2px; overflow:hidden; margin-top:12px;
}
.live-progress-bar {
  height:100%;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  width:0%; transition:width .3s ease-out;
}
.live-current-file {
  padding:12px 20px; background:var(--bg-2);
  border-bottom:1px solid var(--border-soft);
  display:flex; align-items:center; gap:10px; flex-shrink:0;
}
.live-current-file .lcf-icon { font-size:16px; }
.live-current-file .lcf-path {
  font-family:Consolas,monospace; font-size:12.5px; flex:1;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.live-current-file .lcf-action {
  font-size:10.5px; padding:3px 8px; border-radius:10px;
  background:rgba(240,165,69,.15); color:var(--warn); font-weight:600;
}
.live-log {
  flex:1; overflow-y:auto; padding:12px 20px;
  font-family:Consolas,monospace; font-size:12px;
  line-height:1.7; min-height:0;
}
.live-log-line { display:flex; gap:10px; padding:2px 0; }
.live-log-line .llt { color:var(--text-mute); flex-shrink:0; width:60px; }
.live-log-line .llm { flex:1; word-break:break-word; }
.live-log-line.success .llm { color:var(--ok); }
.live-log-line.error .llm { color:var(--err); }
.live-log-line.warn .llm { color:var(--warn); }
.live-log-line.agent .llm { color:var(--accent); font-weight:600; }
.live-log-line.file .llm { color:var(--accent-2); }
.live-log-line.dim .llm { color:var(--text-dim); }

.live-tests {
  padding:14px 20px; background:var(--bg-2);
  border-top:1px solid var(--border-soft);
  flex-shrink:0; max-height:220px; overflow-y:auto;
}
.live-tests-head {
  display:flex; align-items:center; gap:10px;
  margin-bottom:10px; font-size:12px; font-weight:700;
  text-transform:uppercase; letter-spacing:.5px;
  color:var(--text-dim);
}
.live-tests-head .badge {
  margin-left:auto; padding:3px 10px;
  border-radius:10px; font-size:10.5px;
}
.live-tests-head .badge.pass { background:rgba(78,201,160,.15); color:var(--ok); }
.live-tests-head .badge.fail { background:rgba(239,90,90,.15); color:var(--err); }
.live-tests-head .badge.running { background:rgba(91,124,250,.15); color:var(--accent); }
.test-line {
  display:flex; align-items:center; gap:8px;
  padding:4px 0; font-size:12px; font-family:Consolas,monospace;
}
.test-line.pass .icon { color:var(--ok); }
.test-line.fail .icon { color:var(--err); }

.live-empty {
  padding:60px 20px; text-align:center;
  color:var(--text-mute); font-size:13px;
}
.live-empty .big { font-size:42px; margin-bottom:12px; opacity:.3; }
.live-actions {
  display:flex; gap:8px; padding:10px 20px;
  background:var(--bg-1);
  border-top:1px solid var(--border-soft);
  flex-shrink:0;
}

#btn-auto-toggle.auto-mode {
  background:linear-gradient(90deg,#4ec9a0,#5b7cfa);
  color:#fff; font-weight:600;
}

.cmd-palette {
  position:fixed; inset:0; background:rgba(0,0,0,.6);
  backdrop-filter:blur(4px); z-index:4000;
  display:flex; align-items:flex-start; justify-content:center;
  padding-top:80px;
}
.cmd-palette.hidden { display:none; }
.cmd-palette-box {
  width:600px; background:var(--bg-1);
  border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow-lg); overflow:hidden;
}
#cmd-input {
  width:100%; background:var(--bg-2); border:none;
  color:var(--text); padding:14px 18px; font-size:14px;
  outline:none; font-family:inherit;
}
.cmd-list { max-height:400px; overflow-y:auto; padding:6px; }
.cmd-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 14px; cursor:pointer;
  border-radius:6px; font-size:13px;
}
.cmd-item.selected { background:rgba(91,124,250,.15); }
.cmd-label { flex:1; }
.cmd-hint { font-size:11px; color:var(--text-dim); font-family:Consolas,monospace; }
.cmd-empty { padding:30px; text-align:center; color:var(--text-mute); }

.global-search {
  position:fixed; inset:0; background:rgba(0,0,0,.6);
  backdrop-filter:blur(4px); z-index:4000;
  display:flex; align-items:flex-start; justify-content:center;
  padding-top:60px;
}
.global-search.hidden { display:none; }
.gs-box {
  width:800px; max-height:80vh; background:var(--bg-1);
  border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow-lg); display:flex; flex-direction:column;
  overflow:hidden;
}
.gs-head {
  display:flex; align-items:center; gap:10px; padding:12px 16px;
  background:var(--bg-2); border-bottom:1px solid var(--border);
}
.gs-head input[type=text] {
  flex:1; background:transparent; border:none; color:var(--text);
  font-size:13px; outline:none; font-family:inherit;
}
.gs-results { flex:1; overflow-y:auto; padding:8px 0; }
.gs-group { margin-bottom:8px; }
.gs-file {
  padding:6px 16px; font-size:11.5px; color:var(--accent-2);
  font-weight:600; background:var(--bg-2);
  position:sticky; top:0; z-index:2;
}
.gs-count { font-size:10px; color:var(--text-mute); margin-left:6px; }
.gs-line {
  display:flex; gap:12px; padding:5px 16px; cursor:pointer;
  font-size:12px; font-family:Consolas,monospace;
}
.gs-line:hover { background:var(--bg-2); }
.gs-num { color:var(--text-mute); min-width:40px; text-align:right; }
.gs-text { color:var(--text-dim); white-space:pre; overflow:hidden; text-overflow:ellipsis; }
.gs-empty { padding:30px; text-align:center; color:var(--text-mute); }
.gs-status {
  padding:8px 16px; background:var(--bg-2); border-top:1px solid var(--border);
  font-size:11px; color:var(--text-dim); font-family:Consolas,monospace;
}

.problems-panel {
  position:fixed; right:20px; bottom:20px;
  width:520px; max-height:60vh; background:var(--bg-1);
  border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow-lg); z-index:3000;
  display:flex; flex-direction:column;
}
.problems-panel.hidden { display:none; }
.pp-head {
  padding:10px 16px; background:var(--bg-2); border-bottom:1px solid var(--border);
  display:flex; justify-content:space-between; align-items:center;
  font-size:12px; font-weight:600; border-radius:12px 12px 0 0;
}
.pp-list { flex:1; overflow-y:auto; padding:6px 0; }
.pp-group { margin-bottom:6px; }
.pp-file {
  padding:5px 14px; font-size:11.5px; color:var(--accent-2);
  font-weight:600; background:var(--bg-2);
}
.pp-count { font-size:10px; color:var(--text-mute); margin-left:6px; }
.pp-line {
  display:flex; align-items:center; gap:10px;
  padding:5px 14px; font-size:12px; cursor:pointer;
}
.pp-line:hover { background:var(--bg-2); }
.pp-icon { font-size:11px; }
.pp-msg { flex:1; }
.pp-loc { font-size:10.5px; color:var(--text-mute); font-family:Consolas,monospace; }
.pp-src { font-size:10px; color:var(--text-mute); padding:1px 6px; background:var(--bg-3); border-radius:3px; }
.pp-empty { padding:30px; text-align:center; color:var(--text-mute); }
#btn-problems.has-problems { color:var(--warn); }

.mcp-catalog-item {
  display:flex; align-items:center; gap:12px;
  padding:12px 14px; background:var(--bg-2); border-radius:10px;
  margin-bottom:8px; cursor:pointer;
}
.mcp-catalog-item:hover { background:var(--bg-3); }
.mcp-catalog-item .mci-icon { font-size:22px; }
.mcp-catalog-item .mci-name { font-weight:600; font-size:13.5px; }
.mcp-catalog-item .mci-desc { font-size:11.5px; color:var(--text-dim); margin-top:3px; }
.mcp-catalog-item .mci-btn {
  background:var(--accent); color:#fff; border:none;
  padding:6px 14px; border-radius:6px; cursor:pointer;
  font-size:11.5px; font-weight:600;
}

.suggestion-card {
  background:var(--bg-2);
  border-left:3px solid var(--accent);
  border-radius:8px; padding:10px 14px; margin-bottom:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.35);
}
.suggestion-card.toast-float {
  position:fixed; bottom:20px; right:20px;
  width:360px; z-index:5000;
  animation:toastSlide .25s ease-out;
}
@keyframes toastSlide {
  from { opacity:0; transform:translateX(30px); }
  to   { opacity:1; transform:translateX(0); }
}
.suggestion-card.warn { border-color:var(--warn); background:rgba(240,165,69,.08); }
.suggestion-card.error { border-color:var(--err); background:rgba(239,90,90,.08); }
.suggestion-card .sc-head {
  display:flex; align-items:center; gap:8px;
  font-size:12px; font-weight:600; margin-bottom:6px;
}
.suggestion-card .sc-actions { display:flex; gap:6px; margin-top:8px; }
.suggestion-card .sc-btn {
  background:var(--bg-2); border:none; color:var(--text);
  padding:5px 12px; border-radius:6px; cursor:pointer;
  font-size:11.5px; font-family:inherit;
}
.suggestion-card .sc-btn.primary { background:var(--accent); color:#fff; }
.suggestion-card .sc-dismiss {
  background:transparent; border:none; color:var(--text-mute);
  cursor:pointer; font-size:14px; padding:0 4px; margin-left:auto;
}

.bottombar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:32px;
  min-height:32px;
  padding:0 12px;
  background:var(--bg-2);
  border-top:1px solid var(--border);
  font-size:12px;
  color:var(--text-dim);
  user-select:none;
  flex-shrink:0;
}
.bottombar .bb-left {
  display:flex; align-items:center; gap:10px;
}
.bottombar .bb-right {
  display:flex; align-items:center; gap:8px;
  margin-left:auto;
}
.bottombar .bb-right button {
  height:22px; padding:0 8px; font-size:11px;
}
.bottombar .version-badge {
  font-size:11px;
  color:var(--text-mute);
  font-weight:500;
  padding-left:6px;
  border-left:1px solid var(--border);
}

.config-row {
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:10px 0; border-bottom:1px solid var(--border);
}
.config-row:last-child { border-bottom:none; }
.config-row p.muted { margin:2px 0 0; font-size:11px; color:var(--text-mute); }

.switch {
  position:relative; display:inline-block;
  width:38px; height:20px; flex-shrink:0;
}
.switch input { opacity:0; width:0; height:0; }
.switch .slider {
  position:absolute; inset:0;
  background:#333; border-radius:20px;
  transition:.2s; cursor:pointer;
}
.switch .slider::before {
  content:""; position:absolute;
  width:14px; height:14px;
  left:3px; top:3px;
  background:#fff; border-radius:50%;
  transition:.2s;
}
.switch input:checked + .slider { background:#5b6cff; }
.switch input:checked + .slider::before { transform:translateX(18px); }

.toolbar .btn {
  padding:6px 8px;
  font-size:11.5px;
  gap:4px;
}
.toolbar .btn.ghost {
  padding:6px 7px;
}
.mode-toggle {
  padding:6px 10px;
  font-size:11.5px;
  gap:5px;
}
.topbar {
  padding:0 8px;
  gap:8px;
}

.panel-files .panel-head {
  padding: 6px 8px;
  gap: 6px;
  justify-content: flex-start;
}
.panel-files .panel-head > div {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  padding-bottom: 2px;
}
.panel-files .panel-head > div::-webkit-scrollbar {
  height: 3px;
}
.panel-files .panel-head .btn.small {
  padding: 5px 9px;
  font-size: 11px;
  flex-shrink: 0;
  white-space: nowrap;
}

html[data-theme="dark"] {
  --bg-0:#0a0a0c; --bg-1:#101014; --bg-2:#16161c; --bg-3:#1d1d25;
  --bg-hover:#232330;
  --border:#232330; --border-soft:#1a1a24;
  --text:#e4e4e8; --text-dim:#8a8a96; --text-mute:#5a5a66;
}

html[data-theme="gray"] {
  --bg-0:#1a1a1f; --bg-1:#222228; --bg-2:#2b2b33; --bg-3:#363640;
  --bg-hover:#40404a;
  --border:#40404a; --border-soft:#333340;
  --text:#e8e8ee; --text-dim:#a0a0b0; --text-mute:#6a6a80;
}

html[data-theme="light"] {
  --bg-0:#f5f5f8; --bg-1:#ffffff; --bg-2:#eeeef2; --bg-3:#e0e0e8;
  --bg-hover:#d8d8e0;
  --border:#c8c8d0; --border-soft:#e0e0e6;
  --text:#1a1a22; --text-dim:#5a5a70; --text-mute:#8a8a96;
}

html[data-theme="light"] body {
  background: var(--bg-0);
  color: var(--text);
}
html[data-theme="light"] .topbar,
html[data-theme="light"] .panel,
html[data-theme="light"] .panel-head,
html[data-theme="light"] .chat-input-wrap {
  background: var(--bg-1);
  color: var(--text);
}
html[data-theme="light"] .msg .body {
  background: var(--bg-2);
  color: var(--text);
}
html[data-theme="light"] .msg.user .who { color: #3b5bdb; }
html[data-theme="light"] .msg.assistant .who { color: #7c3aed; }
html[data-theme="light"] .msg.system .who { color: #b45309; }
html[data-theme="light"] .btn { color: var(--text); }
html[data-theme="light"] .btn:hover { background: var(--bg-2); }
html[data-theme="light"] .btn.primary { color: #fff; }
html[data-theme="light"] .bottombar {
  background: var(--bg-2);
  color: var(--text-dim);
  border-top-color: var(--border);
}
html[data-theme="light"] .chat-input textarea {
  background: var(--bg-2);
  color: var(--text);
}
html[data-theme="light"] .chat-input textarea::placeholder {
  color: var(--text-mute);
}
html[data-theme="light"] .tree-node:hover { background: var(--bg-2); }
html[data-theme="light"] .modal-box {
  background: var(--bg-1);
  color: var(--text);
}
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: var(--bg-2);
  color: var(--text);
}
html[data-theme="light"] .dropdown-menu {
  background: var(--bg-1);
  border-color: var(--border);
  box-shadow: 0 16px 36px rgba(0,0,0,0.12);
}
html[data-theme="light"] .dropdown-header {
  color: var(--text-dim);
}
html[data-theme="light"] .dropdown-divider {
  background: var(--border-soft);
}
html[data-theme="light"] .dropdown-item {
  color: var(--text);
}
html[data-theme="light"] .dropdown-item:hover {
  background: var(--bg-2);
  color: var(--text);
}
html[data-theme="light"] .browser-bar {
  background: var(--bg-1);
  border-bottom-color: var(--border);
}
html[data-theme="light"] .browser-viewport {
  background: var(--bg-0);
}
html[data-theme="light"] .browser-viewport.responsive-mode {
  background: #e2e8f0;
}

.btn-danger {
  background: #ef4444 !important;
  color: #fff !important;
  animation: none !important;
  box-shadow: none !important;
}
.btn-danger:hover {
  background: #dc2626 !important;
}

.agent-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.stream-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(91,124,250,.08);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.stream-agent-block {
  margin-bottom: 14px;
  border-left: 2px solid rgba(91,124,250,.2);
  padding-left: 12px;
}
.stream-agent-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.stream-agent-name {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.stream-agent-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.stream-agent-chip.running {
  background: rgba(91,124,250,.15);
  color: var(--accent);
}
.stream-agent-chip.done {
  color: var(--ok);
  font-size: 11px;
}
.stream-agent-chip.waiting {
  color: var(--text-mute);
  font-size: 11px;
}
.stream-agent-body {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 13px;
  color: var(--text);
}
.stream-agent-body.thinking {
  color: var(--text-mute);
  font-size: 12.5px;
}

.agent-thinking-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-2, #a673ff);
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 0 8px;
}
.pulse-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #a78bfa);
  opacity: 0.35;
  animation: pulseDotAnim 1.4s infinite ease-in-out both;
}
.pulse-dot:nth-child(1) { animation-delay: -0.32s; }
.pulse-dot:nth-child(2) { animation-delay: -0.16s; }
.pulse-dot:nth-child(3) { animation-delay: 0s; }

@keyframes pulseDotAnim {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.3;
  }
  40% {
    transform: scale(1.15);
    opacity: 1;
  }
}

/* Turn Card & Thought Streaming */
.turn-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.turn-card.is-live {
  position: relative;
}
.turn-thought {
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-mute, #94a3b8);
}
.turn-thought-summary {
  cursor: pointer;
  font-weight: 500;
  user-select: none;
  outline: none;
}
.turn-thought-summary:hover {
  color: var(--text, #f1f5f9);
}
.turn-steps {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim, #cbd5e1);
}
.turn-steps li {
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}
.turn-explore {
  margin: 2px 0;
}
.turn-explore-pill {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent, #818cf8);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.turn-explore-pill:hover {
  background: rgba(99, 102, 241, 0.22);
}
.turn-explore-list {
  list-style: none;
  margin: 4px 0 0 0;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  max-height: 120px;
  overflow-y: auto;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-mute, #94a3b8);
}
.turn-explore-list li {
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turn-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent, #a5b4fc);
  font-weight: 500;
  width: fit-content;
}
.turn-status-text {
  letter-spacing: 0.2px;
}
.turn-answer {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text, #f8fafc);
}
.turn-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--warn, #fbbf24);
}
.turn-card.is-failed .turn-status {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.mini-dots {
  display: inline-flex;
  gap: 2px;
}
.mini-dots > span {
  width: 3px; height: 3px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.85;
}

.agent-closing {
  background: transparent;
  border: none;
  padding: 8px 0 4px;
  margin-top: 8px;
}
.agent-closing-title {
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-size: 12px;
}
.agent-closing-sub {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.agent-closing-list {
  margin: 0 0 0 16px;
  padding: 0;
  color: var(--text-dim);
  font-size: 12px;
}
.agent-closing-list li {
  margin-bottom: 3px;
  line-height: 1.4;
}
.agent-closing-warn {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--warn);
}
#chat-send { padding: 6px 14px; font-size: 12px; font-weight: 600; min-width: 68px; height: 32px; border-radius: 8px; }
#chat-send.btn-danger { min-width: 36px !important; width: 36px !important; height: 32px !important; padding: 0 !important; background: #ef4444 !important; color: transparent !important; font-size: 0 !important; position: relative !important; border-radius: 8px !important; }
#chat-send.btn-danger::after { content: '' !important; position: absolute !important; top: 50% !important; left: 50% !important; width: 10px !important; height: 10px !important; background: #fff !important; border-radius: 2px !important; transform: translate(-50%, -50%) !important; }

.mentions-dropdown {
  position: fixed;
  z-index: 10000;
  background: var(--bg-panel, #12151b);
  border: 1px solid var(--border-color, #2a2f3d);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  max-height: 240px;
  overflow-y: auto;
  min-width: 320px;
  backdrop-filter: blur(8px);
}
.mentions-dropdown.hidden {
  display: none !important;
}
.mentions-list {
  display: flex;
  flex-direction: column;
  padding: 4px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-color, #e2e8f0);
  transition: background 0.15s ease;
}
.mention-item:hover, .mention-item.selected {
  background: var(--accent-gradient, rgba(124, 92, 255, 0.25));
  color: #fff;
}
.mention-item .mi-icon {
  font-size: 13px;
}
.mention-item .mi-label {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-item .mi-hint {
  font-size: 11px;
  color: var(--text-mute, #64748b);
  white-space: nowrap;
}

.inline-edit-overlay {
  position: fixed;
  z-index: 9999;
  background: var(--bg-panel, #131722);
  border: 1px solid var(--accent, #7c5cff);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(12px);
  animation: ieFadeIn 0.18s ease-out;
}
@keyframes ieFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.inline-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2, #a673ff);
}
.inline-edit-header .ie-close {
  background: transparent;
  border: none;
  color: var(--text-mute, #64748b);
  cursor: pointer;
  font-size: 14px;
}
.inline-edit-header .ie-close:hover {
  color: #fff;
}
.inline-edit-overlay .ie-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, #2d3345);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12.5px;
  outline: none;
}
.inline-edit-overlay .ie-input:focus {
  border-color: var(--accent, #7c5cff);
}
.inline-edit-hints {
  display: flex;
  gap: 12px;
  font-size: 10.5px;
  color: var(--text-mute, #64748b);
}
.inline-edit-loading {
  background: rgba(124, 92, 255, 0.2);
  border-bottom: 2px dashed #7c5cff;
}

.term-fix-error-btn {
  background: linear-gradient(135deg, #7c5cff, #a855f7) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  animation: none !important;
}

/* ═══════════════════════════════════════════════════════════
   v29: BARRA DE STATUS EN VIVO + TRACE EN VIVO
   ═══════════════════════════════════════════════════════════ */

.agent-live-status {
  margin: 4px 8px 8px;
  padding: 8px 10px;
  background: rgba(167, 139, 250, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.42);
  border-radius: 6px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  animation: liveBarIn 0.2s ease-out;
}
@keyframes liveBarIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.agent-live-status .live-dot {
  width: 8px; height: 8px;
  background: #a855f7;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(168, 85, 247, 0.6);
}
.agent-live-status .live-label {
  color: var(--text-dim);
  flex-shrink: 0;
  font-weight: 600;
}
.agent-live-status .live-path {
  color: #c084fc;
  font-family: Consolas, monospace;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(167, 139, 250, 0.15);
  padding: 1px 6px;
  border-radius: 3px;
}
.agent-live-status.is-write {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.45);
}
.agent-live-status.is-write .live-dot {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.9);
}
.agent-live-status.is-write .live-path {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.15);
}

.live-trace-panel {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: 8px;
  font-size: 12px;
  animation: liveTraceIn 0.25s ease-out;
}
@keyframes liveTraceIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.live-trace-title {
  font-weight: 700;
  color: #a78bfa;
  margin-bottom: 8px;
  font-size: 11.5px;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-trace-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}
.live-trace-list li {
  padding: 3px 0;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.4;
}
.live-trace-list li.ok { color: var(--ok); }
.live-trace-list li.err { color: var(--err); }
.live-trace-list li.warn { color: var(--warn); }
.live-trace-list li.info { color: var(--accent); }
.live-trace-list code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: Consolas, monospace;
  color: #a78bfa;
  font-size: 11px;
}
.trace-path {
  color: var(--text-dim);
  font-size: 11px;
  font-family: Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* ═══════════════════════════════════════════════════════════
   v30: Estados de archivo (working / touched / done)
   ═══════════════════════════════════════════════════════════ */
.agent-live-status.is-done {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.45);
}
.agent-live-status.is-done .live-dot {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.9);
  animation: none;
}
.agent-live-status.is-done .live-path {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.15);
}
.agent-live-status.is-error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.45);
}
.agent-live-status.is-error .live-dot {
  background: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.9);
  animation: none;
}
.agent-live-status.is-error .live-path {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.15);
}
.agent-live-status .live-count {
  font-size: 10.5px;
  color: var(--text-mute, #64748b);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.agent-live-status .live-dismiss {
  background: transparent;
  border: none;
  color: var(--text-mute, #64748b);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
  line-height: 1;
  flex-shrink: 0;
}
.agent-live-status .live-dismiss:hover {
  color: var(--text, #e2e8f0);
}

.tree-node.agent-touched-file {
  background: rgba(52, 211, 153, 0.06);
}
.agent-touched-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.8;
}
.tree-node.agent-touched-file .agent-touched-dot.write {
  background: #f59e0b;
}
/* ============================================================
   Arbol alineado a la derecha (icono a la derecha del nombre);
   los indicadores del agente quedan en el borde izquierdo.
   ============================================================ */
.tree-node {
  position: relative !important;
}
.file-tree .tree-node {
  flex-direction: row-reverse;
  justify-content: flex-start;
  text-align: right;
  padding-left: 26px;
}
.file-tree .tree-node .tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-tree .tree-node .tree-icon {
  flex-shrink: 0;
}
.file-tree .tree-node.tree-root {
  font-weight: 600;
  color: var(--text-dim);
}
.tree-node.agent-touched-file {
  border-left: 2px solid rgba(52, 211, 153, 0.55);
}
.tree-node .agent-dot,
.tree-node .agent-touched-dot,
.tree-node .file-status {
  position: absolute !important;
  left: 10px !important;
  right: auto !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.np-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.np-label { font-size: 12px; font-weight: 600; color: var(--text); }
.np-input { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 13px; outline: none; }
.np-input:focus { border-color: var(--accent); }
.np-ids { font-size: 11px; min-height: 14px; }
.np-checks { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text); }
.np-checks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.project-conn { margin-top: 6px; }
.project-conn-line { font-size: 11.5px; color: var(--warn); line-height: 1.6; }
.project-conn-line.ok { color: var(--ok); }
.project-conn-hint { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ============================================================
   Tarjeta de turno del agente (Pensamiento / Explorados / estado)
   ============================================================ */
.turn-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.turn-thought {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.turn-thought-summary {
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-dim);
  user-select: none;
}
.turn-steps {
  list-style: none;
  margin: 0;
  padding: 0 10px 8px;
  max-height: 190px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-dim);
}
.turn-steps li {
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turn-explore-pill {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
}
.turn-explore-pill.is-open {
  border-color: var(--accent);
}
.turn-explore-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 11.5px;
  color: var(--text-dim);
  max-height: 160px;
  overflow-y: auto;
}
.turn-explore-list li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turn-answer:empty {
  display: none;
}
.turn-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-2);
  font-size: 12.5px;
  font-weight: 500;
}
.turn-card:not(.is-live) .turn-status {
  display: none !important;
}
.turn-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
}
.turn-card.is-failed .turn-note {
  color: var(--warn);
}

/* ============================================================
   PROVIDER MANAGEMENT - ADMIN & USER ROLES
   ============================================================ */

.role-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border-radius: 8px;
  padding: 4px;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.role-btn:hover {
  color: var(--text);
  background: var(--bg-3);
}

.role-btn.active {
  background: var(--accent);
  color: white;
}

.role-icon {
  font-size: 14px;
}

.provider-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* USER VIEW - Model Cards */
.user-model-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-model-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.user-model-card.active {
  background: rgba(124, 92, 255, 0.15);
  border-color: var(--accent);
}

.user-model-info {
  flex: 1;
}

.user-model-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.user-model-status {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.user-model-select-icon {
  font-size: 20px;
  color: var(--text-dim);
  transition: color 0.2s;
}

.user-model-card.active .user-model-select-icon {
  color: var(--accent);
}

/* ADMIN VIEW - Provider Cards */
.admin-provider-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.admin-provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.admin-provider-info {
  flex: 1;
}

.admin-provider-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.admin-provider-url {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'Consolas', monospace;
}

.admin-provider-actions {
  display: flex;
  gap: 6px;
}

.admin-provider-body {
  padding: 20px;
}

.admin-group-card {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.admin-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-group-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.admin-group-key-section {
  margin-bottom: 12px;
}

.admin-group-key-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: block;
}

.admin-group-key-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'Consolas', monospace;
  outline: none;
  transition: all 0.2s;
}

.admin-group-key-input:focus {
  background: var(--bg-3);
  border-color: var(--accent);
}

.admin-group-models {
  margin-top: 12px;
}

.admin-group-models-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-models-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 6px 10px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-family: 'Consolas', monospace;
}

.admin-model-chip-remove {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  transition: color 0.2s;
}

.admin-model-chip-remove:hover {
  color: var(--err);
}

.admin-add-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 6px 10px;
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-add-model-btn:hover {
  background: rgba(124, 92, 255, 0.1);
}

.provider-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
}

.provider-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.provider-empty-text {
  font-size: 14px;
  margin-bottom: 8px;
}

.provider-empty-hint {
  font-size: 12px;
  color: var(--text-dim);
}

/* Provider Badge */
.provider-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.provider-badge.custom {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-2);
}

.provider-badge.default {
  background: rgba(52, 211, 153, 0.2);
  color: var(--ok);
}

/* ============================================================ */
/* ESTILOS DE ADMINISTRACIÓN Y CONFIGURACIÓN (Estilo EditCoreAI) */
/* ============================================================ */

:root {
  --ec-bg: var(--bg-0, #0d1017);
  --ec-bg-elevated: var(--bg-2, #151923);
  --ec-bg-soft: var(--bg-1, #0d1017);
  --ec-border: var(--border, #222738);
  --ec-border-strong: rgba(255, 255, 255, 0.14);
  --ec-text: var(--text, #e6edf3);
  --ec-text-muted: var(--text-dim, #94a3b8);
  --ec-hover: rgba(255, 255, 255, 0.05);
  --ec-accent: #3b82f6;
  --ec-accent-soft: rgba(59, 130, 246, 0.15);
  --ec-shadow: rgba(0, 0, 0, 0.5);
}

/* Botones de Administración en Topbar */
.toolbar-admin-btn {
  color: #d97706 !important;
  font-weight: 600;
  background: transparent;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toolbar-admin-btn:hover {
  background: rgba(217, 119, 6, 0.12);
  border-color: #d97706;
}

.toolbar-admin-btn.ec-preview-exit-btn {
  background: #f5a524 !important;
  color: #1b1300 !important;
  font-weight: 700;
  border-radius: 6px;
  border: none !important;
  padding: 4px 12px;
}

.toolbar-admin-btn.ec-preview-exit-btn:hover {
  background: #ffb93d !important;
  color: #1b1300 !important;
}

/* Modal Overlay & Card */
.ec-settings-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ec-settings-sheet-overlay.is-open {
  display: flex !important;
}

.ec-settings-modal-card {
  position: relative;
  width: min(1040px, calc(100vw - 48px));
  height: min(720px, 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;
}

.ec-settings-logout-wrap {
  margin-top: auto;
  margin-bottom: 8px;
}

.ec-user-logout-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ec-user-logout-btn:hover {
  background: rgba(239, 68, 68, 0.18);
}

/* Tarjeta Perfil de Usuario en Sidebar */
.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);
  position: relative;
}

.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;
}

.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);
}

.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);
}

.ec-segmented-btn-group {
  display: flex;
  background: var(--ec-bg-soft);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.ec-seg-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--ec-text-muted);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s;
}

.ec-seg-btn.is-active {
  background: var(--ec-bg-elevated);
  color: var(--ec-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ec-btn-action {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--ec-border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ec-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.ec-btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ec-btn-gold {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.ec-btn-gold:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.ec-status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.ec-tag-success {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

.ec-tag-info {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}

/* Master Dashboard Card */
.ec-master-dashboard-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 14px;
  padding: 18px 20px;
  color: #f8fafc;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ec-master-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ec-master-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.ec-master-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.ec-metric-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ec-metric-title {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ec-metric-number {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ec-metric-sub {
  font-size: 11px;
  color: #64748b;
}

.text-emerald { color: #34d399; }
.text-indigo { color: #818cf8; }
.text-cyan { color: #22d3ee; }

/* Saldo Global Card (ME AI / GafCoreAI) */
.mx-card {
  --mx-border: rgba(148, 163, 184, 0.16);
  --mx-muted: #94a3b8;
  --mx-faint: #64748b;
  --mx-text: #e2e8f0;
  --mx-strong: #f8fafc;
  --mx-accent: #34d399;
  --mx-blue: #3b82f6;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--mx-border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--mx-text);
}

.mx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mx-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--mx-strong);
}

.mx-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--mx-muted);
}

.mx-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mx-updated {
  font-size: 11px;
  color: var(--mx-faint);
}

.mx-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--mx-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--mx-text);
  font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.mx-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mx-btn-primary {
  background: var(--mx-blue);
  border-color: var(--mx-blue);
  color: #fff;
}

.mx-btn-primary:hover {
  background: #2563eb;
}

.mx-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--mx-border);
  border-radius: 10px;
  overflow: hidden;
}

.mx-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
}

.mx-kpi + .mx-kpi {
  border-left: 1px solid var(--mx-border);
}

.mx-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--mx-muted);
  text-transform: uppercase;
}

.mx-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--mx-strong);
}

.mx-kpi-accent .mx-kpi-value {
  color: var(--mx-accent);
}

.mx-kpi-hint {
  font-size: 11px;
  color: var(--mx-faint);
}

.mx-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mx-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.mx-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--mx-blue);
  transition: width 0.4s ease;
}

.mx-progress-legend {
  font-size: 11px;
  color: var(--mx-muted);
}

.mx-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid var(--mx-border);
}

.mx-panel-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--mx-strong);
}

.mx-panel-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--mx-muted);
}

.mx-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}

.mx-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mx-field-wide {
  grid-column: span 2;
}

.mx-field > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--mx-muted);
}

.mx-input {
  height: 34px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--mx-border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--mx-strong);
  font: 500 13px/1 system-ui, sans-serif;
}

.mx-preview {
  font-size: 12px;
  color: var(--mx-text);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.mx-panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mx-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}

.mx-setting-text strong {
  font-size: 13px;
  color: var(--mx-strong);
  display: block;
}

.mx-setting-text span {
  font-size: 12px;
  color: var(--mx-muted);
}

.mx-setting-control {
  display: flex;
  gap: 8px;
}

.mx-setting-control .mx-input {
  width: 130px;
}

.mx-table-wrap {
  border: 1px solid var(--mx-border);
  border-radius: 10px;
  overflow: auto;
}

.mx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mx-table th, .mx-table td {
  padding: 9px 14px;
  text-align: right;
  white-space: nowrap;
}

.mx-table th:first-child, .mx-table td:first-child {
  text-align: left;
}

.mx-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--mx-muted);
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--mx-border);
}

.mx-table tbody tr + tr td {
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.mx-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--mx-muted);
  padding: 4px 0 8px;
}

/* Herramientas de Administración (Mercado Pago, Usuarios) */
.ec-admin-tool {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ec-admin-tool h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.ec-admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ec-admin-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.ec-admin-user-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.ec-admin-user-row.is-suspended {
  opacity: 0.55;
  background: rgba(239, 68, 68, 0.06);
}

.ec-admin-user-email {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ec-admin-user-email > span {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.ec-admin-user-activity {
  font-size: 11px;
  color: #94a3b8;
}

.ec-admin-user-activity.is-online {
  color: #10b981;
}

.ec-admin-users-summary {
  font-size: 11px;
  color: #94a3b8;
  padding: 2px 4px 6px;
  font-weight: 600;
}

/* Banner de Saldo para Usuarios Normales */
.ec-credits-overview-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 14px;
}

.ec-credits-caption {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
}

.ec-credits-big-num {
  font-size: 32px;
  font-weight: 700;
  color: #f8fafc;
}

.ec-credits-plan-tag {
  font-size: 12px;
  color: #94a3b8;
}

