:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #26334a;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --purple: #a855f7;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 55%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(30, 41, 59, 0.96);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
}
.login-icon { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 10px; }
.login-card form { text-align: left; margin-top: 16px; }
.btn-block { width: 100%; padding: 12px; font-size: 1rem; }

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 16px 88px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-img { width: 40px; height: 40px; border-radius: 10px; }
.brand h1 { margin: 0; font-size: 1.2rem; }
.subtitle { margin: 0; color: var(--muted); font-size: 0.82rem; }

.status-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pill {
  padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); display: inline-block;
}
.pill-ok { background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.45); color: #6ee7b7; }
.pill-warn { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.45); color: #fcd34d; }
.pill-error { background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.pill-info { background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.5); color: #93c5fd; }
.pill-purple { background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.5); color: #d8b4fe; }
.pill-neutral { color: var(--muted); }

/* Navegación superior en escritorio, barra inferior en celular para uso con una mano */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.92rem;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 768px) {
  .tabs.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(15, 23, 42, 0.97);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    backdrop-filter: blur(12px);
  }
  .tabs.bottom-nav .tab {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    font-size: 0.78rem;
    border-radius: 10px;
    border: none;
    background: transparent;
  }
  .tabs.bottom-nav .tab.active {
    background: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
  }
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.grid-two { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; margin-bottom: 16px; }
.grid-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 900px) {
  .grid-two, .grid-compact { grid-template-columns: 1fr; }
}

.card {
  background: rgba(30, 41, 59, 0.93);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.card h2 { margin: 0; font-size: 1.08rem; }
.card h3 { margin: 12px 0 8px; font-size: 0.95rem; color: #cbd5e1; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 0.85rem; font-weight: 600; color: #cbd5e1; margin-bottom: 5px; }

input[type="text"], input[type="password"], select, textarea {
  width: 100%; background: #0f172a; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 0.95rem; font-family: inherit;
}
textarea { resize: vertical; }

.input-with-actions { display: flex; gap: 8px; }
.input-with-actions input { flex: 1; }

.checkbox-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chip-check {
  display: inline-flex !important; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; font-weight: 500 !important;
}
.inline-check {
  display: inline-flex !important; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--muted); cursor: pointer; margin-top: 4px;
}

.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
@media (max-width: 680px) { .tools-grid { grid-template-columns: 1fr; } }
.tool-card {
  background: #0f172a; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; font-size: 0.8rem;
}
.tool-card strong { display: block; font-size: 0.86rem; margin-bottom: 4px; }
.tool-card .tool-detail { color: var(--muted); font-size: 0.75rem; margin-top: 4px; }

.voice-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px; background: rgba(15, 23, 42, 0.7); border: 1px dashed var(--border);
  border-radius: 10px; margin-bottom: 12px;
}
.voice-status { font-size: 0.82rem; color: var(--muted); }

.btn {
  border: none; border-radius: 10px; padding: 10px 14px; font-weight: 600;
  cursor: pointer; font-size: 0.9rem; transition: 0.15s ease;
}
.btn-sm { padding: 6px 10px; font-size: 0.8rem; border-radius: 8px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: #93c5fd; border: 1px solid rgba(59,130,246,0.35); }
.btn-warning { background: var(--warn); color: #111827; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-voice { background: #7c3aed; color: #fff; }
.btn-voice.recording { background: #dc2626; }

.actions-bar, .actions-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.alert {
  padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 0.88rem;
  border: 1px solid var(--border); background: var(--surface-2); white-space: pre-wrap;
}
.alert-error { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.5); color: #fecaca; }
.alert-ok { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.5); color: #a7f3d0; }

.info-box {
  background: rgba(15, 23, 42, 0.82); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px; font-size: 0.84rem; margin-bottom: 12px;
  white-space: pre-wrap;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.86rem; }

.plan-preview {
  margin-top: 12px; padding: 12px; border-radius: 10px;
  background: rgba(15, 23, 42, 0.88); border: 1px solid rgba(59, 130, 246, 0.45);
}
.plan-item {
  padding: 8px 10px; border-left: 3px solid var(--primary);
  background: rgba(30, 41, 59, 0.72); border-radius: 6px; margin-bottom: 8px; font-size: 0.85rem;
}

.tasks-list { display: flex; flex-direction: column; gap: 10px; max-height: 540px; overflow-y: auto; }
.task-item {
  background: #0f172a; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; cursor: pointer;
}
.task-item:hover, .task-item.selected { border-color: var(--primary); background: #172554; }
.task-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 5px; flex-wrap: wrap; }
.task-prompt { font-size: 0.88rem; margin: 0 0 5px; }

.steps-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.step-card { background: #0f172a; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.step-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-result {
  background: #111827; border: 1px solid #1f2937; border-radius: 8px;
  padding: 10px; margin-top: 8px; max-height: 240px; overflow: auto;
  white-space: pre-wrap; font-family: Consolas, monospace; font-size: 0.82rem;
}

.assisted-box, .approval-box {
  margin-top: 10px; padding: 11px; border-radius: 10px;
  background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.45);
}
.approval-box { background: rgba(168, 85, 247, 0.12); border-color: rgba(168, 85, 247, 0.5); }

.artifact-viewer {
  margin-top: 12px; padding: 12px; background: #0b1120;
  border: 1px solid var(--primary); border-radius: 10px;
}
.artifact-viewer pre {
  max-height: 360px; overflow: auto; white-space: pre-wrap;
  font-family: Consolas, monospace; font-size: 0.84rem; margin: 0;
}

.events-box { margin-top: 14px; background: #0f172a; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.events-box ul { margin: 8px 0 0; padding-left: 18px; font-size: 0.82rem; color: #cbd5e1; }

.computers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 12px; }
.comp-card { background: #0f172a; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
code { background: #0f172a; padding: 2px 5px; border-radius: 4px; font-family: Consolas, monospace; font-size: 0.82rem; }
