:root {
  --izar-core: #4FA8FF;
  --izar-core-deep: #2E86E0;
  --izar-accent: #FF3D8A;
  --izar-accent-deep: #E01F70;
  --izar-surface: #F8F9FE;
  --izar-text: #26305C;
  --izar-muted: rgba(38, 48, 92, 0.58);
  --izar-ink: #4A5568;
  --izar-card: #FFFFFF;
  --izar-card-shadow: 0 1px 2px rgba(38, 48, 92, 0.05), 0 8px 24px rgba(38, 48, 92, 0.06);
  --izar-spine: rgba(47, 134, 224, 0.28);
  --izar-hair: rgba(38, 48, 92, 0.13);
  --izar-hair-strong: rgba(38, 48, 92, 0.22);
  --izar-success: #1E9C82;
  --izar-warning: #B9790A;
  --izar-error: #D6435A;
  --izar-radius-sm: 6px;
  --izar-radius-pill: 999px;
  --izar-motion-fast: 150ms;
  --izar-motion-deliberate: 900ms;

  --izar-font-body: 'Nunito Sans', system-ui, -apple-system, sans-serif;
  --izar-font-display: 'Outfit', system-ui, sans-serif;
  --izar-font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--izar-font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  background: var(--izar-surface);
  color: var(--izar-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--izar-font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--izar-text);
}

h1 { font-size: clamp(28px, 4vw, 38px); }
h2 { font-size: 22px; margin-top: 1.6em; }
h3 { font-size: 18px; }
h4, h5, h6 { font-size: 16px; }

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--izar-core-deep);
  text-decoration: none;
}

a:hover {
  color: var(--izar-accent);
}

b, strong {
  font-weight: 700;
}

small {
  font-size: 12px;
}

code {
  font-family: var(--izar-font-mono);
  font-size: 0.875em;
  color: var(--izar-accent-deep);
  background: rgba(79, 168, 255, 0.1);
  padding: 1px 5px;
  border-radius: var(--izar-radius-sm);
}

pre {
  margin: 0;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

label {
  font-weight: 700;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

::placeholder {
  color: var(--izar-muted);
  opacity: 1;
}

.izar-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 249, 254, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--izar-hair);
  padding: 16px clamp(20px, 6vw, 88px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.izar-nav .izar-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--izar-text);
  text-decoration: none;
}

.izar-nav .izar-up {
  color: var(--izar-accent-deep);
  font-weight: 800;
  font-size: 12.5px;
  text-decoration: none;
}

.izar-nav .izar-up:hover {
  color: var(--izar-accent);
}

.izar-canvas {
  margin-left: clamp(20px, 6vw, 88px);
  margin-right: auto;
  max-width: 1100px;
  padding-bottom: 64px;
}

.izar-section {
  position: relative;
  padding: 52px 0;
}

.izar-section + .izar-section {
  border-top: 1px solid var(--izar-hair-strong);
}

.izar-section-grid {
  display: grid;
  grid-template-columns: 112px 1fr;
  column-gap: 28px;
}

.izar-gutter {
  position: relative;
}

.izar-gutter::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: -53px;
  left: 5px;
  width: 1.5px;
  background: var(--izar-spine);
}

.izar-section:last-child .izar-gutter::before {
  bottom: 0;
}

.izar-tick {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--izar-core);
  margin-bottom: 12px;
}

.izar-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--izar-ink);
}

.izar-section p {
  max-width: 68ch;
}

.izar-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.izar-page-head h1 {
  margin-bottom: 0.25em;
}

.izar-page-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.izar-create {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 28px;
}

.izar-create .izar-field {
  margin-bottom: 0;
}

.izar-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.izar-btn {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 800;
  font-size: 16px;
  border-radius: var(--izar-radius-pill);
  padding: 15px 28px 15px 22px;
  border: none;
  background: var(--izar-accent);
  color: #fff;
  cursor: pointer;
  transition: background var(--izar-motion-fast) ease;
}

.izar-btn:hover {
  background: var(--izar-accent-deep);
}

.izar-btn:focus-visible {
  outline: none;
  position: relative;
}

.izar-btn:focus-visible::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 130%;
  height: 2px;
  background: var(--izar-core);
}

.izar-btn:disabled {
  background: var(--izar-hair-strong);
  color: var(--izar-muted);
  cursor: not-allowed;
}

.izar-btn .izar-ascend {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: izar-ascend 1.1s ease-in-out infinite;
}

@keyframes izar-ascend {
  0% { transform: translateY(3px); opacity: 0.3; }
  50% { transform: translateY(-3px); opacity: 1; }
  100% { transform: translateY(3px); opacity: 0.3; }
}

.izar-link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--izar-core-deep);
  padding: 0;
  text-decoration: none;
  border-bottom: 2px solid var(--izar-core-deep);
}

.izar-ghost {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--izar-muted);
  padding: 0;
}

.izar-btn-quiet {
  display: inline-block;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 800;
  font-size: 15px;
  border-radius: var(--izar-radius-pill);
  padding: 13px 26px;
  border: 1.5px solid var(--izar-hair-strong);
  background: transparent;
  color: var(--izar-text);
  text-decoration: none;
  transition: border-color var(--izar-motion-fast) ease, color var(--izar-motion-fast) ease;
}

.izar-btn-quiet:hover {
  border-color: var(--izar-core);
  color: var(--izar-core-deep);
}

.izar-alt {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.izar-field {
  position: relative;
  max-width: 340px;
  margin-bottom: 24px;
}

.izar-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--izar-ink);
}

.izar-field input[type="text"],
.izar-field input[type="email"],
.izar-field input[type="password"],
.izar-field input[type="number"],
.izar-field textarea,
.izar-field select {
  width: 100%;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  color: var(--izar-text);
  border: none;
  border-bottom: 1.5px solid var(--izar-hair-strong);
  border-radius: 0;
  padding: 9px 2px;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.izar-field::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--izar-core);
  transition: width 0.25s ease;
}

.izar-field:focus-within::after {
  width: 106%;
}

.izar-field input.izar-error,
.izar-field textarea.izar-error {
  border-bottom-color: var(--izar-error);
}

.izar-hint-error {
  font-size: 12px;
  color: var(--izar-error);
  margin-top: 7px;
}

.izar-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--izar-text);
  border-left: 2px solid var(--izar-core);
  padding: 4px 0 4px 18px;
  margin: 20px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.izar-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px 5px 11px;
  border-radius: var(--izar-radius-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1.3px solid currentColor;
}

.izar-tag-core { color: var(--izar-core-deep); }
.izar-tag-accent { color: var(--izar-accent); }
.izar-tag-success { color: var(--izar-success); }
.izar-tag-warning { color: var(--izar-warning); }
.izar-tag-error { color: var(--izar-error); }

.izar-loading {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 7px;
  vertical-align: middle;
  animation: izar-ascend 1.1s ease-in-out infinite;
}

.izar-tool {
  display: flex;
  flex-direction: column;
  background: var(--izar-card);
  border: 1px solid var(--izar-hair);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--izar-card-shadow);
}

.izar-tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.izar-tool .izar-tool-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.25;
}

.izar-tool .izar-tool-url {
  font-size: 14px;
  color: var(--izar-ink);
  margin: 6px 0 20px;
  overflow-wrap: anywhere;
}

.izar-tool-repo {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  color: var(--izar-ink);
}

.izar-tool-repo code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.izar-tool-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--izar-hair);
  margin-bottom: 20px;
}

.izar-tool-stats div {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--izar-ink);
}

.izar-tool-stats div b {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  color: var(--izar-text);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

.izar-tool-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--izar-hair);
}

.izar-timeline {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 44px;
  margin-bottom: 20px;
}

.izar-timeline .izar-bar {
  width: 5px;
  background: var(--izar-core);
  opacity: 0.35;
  border-radius: 2px;
}

.izar-timeline .izar-bar.now {
  opacity: 1;
  background: var(--izar-success);
}

.izar-alert {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--izar-hair);
}

.izar-alert:first-child {
  border-top: none;
}

.izar-alert .izar-alert-bar {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}

.izar-alert .izar-alert-icon {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.izar-alert b {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 3px;
  color: inherit;
}

.izar-alert p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--izar-text);
  opacity: 0.85;
}

.izar-alert-success { color: var(--izar-success); }
.izar-alert-error { color: var(--izar-error); }
.izar-alert-info { color: var(--izar-core-deep); }

.izar-footer {
  margin-top: 40px;
  border-top: 1px solid var(--izar-hair-strong);
  padding: 40px clamp(20px, 6vw, 88px) 32px;
}

.izar-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-start;
  max-width: 1100px;
}

.izar-footer-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--izar-text);
}

.izar-footer-slogan {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--izar-muted);
  max-width: 40ch;
}

.izar-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.izar-footer-links a {
  color: var(--izar-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.izar-footer-links a::before {
  content: '˄';
  margin-right: 5px;
  color: var(--izar-core);
  opacity: 0.7;
}

.izar-footer-links a:hover {
  color: var(--izar-text);
}

.izar-footer-base {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--izar-hair);
  display: flex;
  align-items: center;
  gap: 10px;
}

.izar-footer-spine {
  display: inline-block;
  width: 1.5px;
  height: 14px;
  background: var(--izar-core);
}

.izar-footer-base small {
  font-size: 12px;
  color: var(--izar-muted);
}

@media (max-width: 760px) {
  .izar-section-grid {
    grid-template-columns: 1fr;
  }
  .izar-gutter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
  }
  .izar-gutter::before {
    display: none;
  }
  .izar-tick {
    margin-bottom: 0;
  }
  .izar-tool-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Modo construcción */
.izar-hint-ok {
  font-size: 13px;
  color: var(--izar-success);
  margin-top: 7px;
}

.izar-draft-note {
  border-left: 2px solid var(--izar-core);
  padding-left: 14px;
  color: var(--izar-muted);
}

.izar-draft {
  background: var(--izar-card);
  border: 1px solid var(--izar-hair);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--izar-card-shadow);
  margin: 20px 0;
}

.izar-draft-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.izar-draft-head b {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
}

.izar-draft p {
  font-size: 14px;
  color: var(--izar-muted);
}

.izar-chat-wait {
  border: 1px solid var(--izar-hair);
  border-radius: 10px;
  padding: 18px 20px;
}

.izar-chat-wait p + p {
  margin-top: 6px;
  color: var(--izar-muted);
}

/* Modo construcción: todo el ancho, sin la línea lateral. El agente a la
   izquierda y la herramienta en vivo a la derecha, ocupando el alto visible. */
.izar-canvas-wide {
  margin: 0;
  max-width: none;
  padding: 0 clamp(12px, 2vw, 24px) 24px;
}

.izar-build-page {
  padding: 14px 0 0;
}

.izar-build-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  margin-bottom: 12px;
}

.izar-build-title h1 {
  font-size: 22px;
  margin: 0;
}

.izar-build-title p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--izar-muted);
}

.izar-build-bar .izar-page-actions form {
  margin: 0;
}

.izar-build {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.izar-build-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--izar-hair);
  border-radius: 14px;
  overflow: hidden;
  background: var(--izar-card);
  box-shadow: var(--izar-card-shadow);
}

.izar-build-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--izar-hair);
}

.izar-build-head b {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
}

.izar-build-head span {
  font-size: 12.5px;
  color: var(--izar-muted);
}

.izar-build-frame {
  width: 100%;
  height: calc(100vh - 175px);
  min-height: 480px;
  border: none;
  background: #fff;
}

.izar-build-loading {
  display: flex;
  align-items: center;
  height: calc(100vh - 175px);
  min-height: 480px;
  padding: 0 20px;
  color: var(--izar-muted);
}

/* Chat con el agente: ocupa la misma altura que el borrador de al lado. */
.izar-chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 175px);
  min-height: 480px;
  background: var(--izar-surface);
}

.izar-chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.izar-chat-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
}

.izar-chat-msg p {
  margin: 0;
}

.izar-chat-msg p + p {
  margin-top: 8px;
}

.izar-chat-msg-agent {
  align-self: flex-start;
  background: var(--izar-card);
  border: 1px solid var(--izar-hair);
  border-bottom-left-radius: 4px;
}

.izar-chat-msg-user {
  align-self: flex-end;
  background: var(--izar-core);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.izar-chat-pending p {
  color: var(--izar-muted);
  animation: izar-chat-pulse 1s ease-in-out infinite;
}

@keyframes izar-chat-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.izar-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--izar-hair);
  background: var(--izar-card);
}

.izar-chat-form input[type="text"] {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14.5px;
  color: var(--izar-text);
  padding: 10px 13px;
  border: 1px solid var(--izar-hair-strong);
  border-radius: var(--izar-radius-pill);
  background: var(--izar-card);
  outline: none;
}

.izar-chat-form input[type="text"]:focus {
  border-color: var(--izar-core);
}

.izar-chat-form .izar-btn {
  margin: 0;
  padding: 10px 22px;
  font-size: 15px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .izar-build {
    grid-template-columns: 1fr;
  }
  .izar-build-frame,
  .izar-build-loading,
  .izar-chat {
    height: 60vh;
    min-height: 420px;
  }
}

