/* =========================================================
   Agentico Lab — dark theme
   ========================================================= */

:root {
  --bg:           #0d1117;
  --bg-card:      #161b22;
  --bg-card-hover:#1c2128;
  --bg-code:      #1c2128;
  --border:       #30363d;
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --accent:       #58a6ff;
  --accent-dim:   rgba(88, 166, 255, 0.08);
  --green:        #3fb950;
  --green-bg:     rgba(46, 160, 67, 0.15);
  --green-border: rgba(63, 185, 80, 0.3);
  --radius:       8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

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

/* ── Header ── */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
  gap: 1rem;
}

.brand h1 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.brand h1 a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.brand h1 a:hover { color: var(--accent); }

.brand .subtitle {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

nav { display: flex; gap: 1.5rem; }

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.15s;
}

nav a:hover { color: var(--text); }

/* ── Main ── */
main { flex: 1; padding: 2rem; }

.container { max-width: 1200px; margin: 0 auto; }

/* ── Section header ── */
.section-header { margin-bottom: 1.25rem; }

.section-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  width: 100%;
}

/* ── Apps grid ── */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.875rem;
}

.app-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.125rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.app-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.app-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.app-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.app-info h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  width: fit-content;
  margin-top: 0.25rem;
}

.badge.online {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

/* ── Empty state ── */
.empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 3rem 0;
  text-align: center;
}

/* ── Bitácora — lista ── */
.bitacora-list {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.bitacora-entry {
  display: block;
  padding: 0.875rem 1.125rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.bitacora-entry:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.entry-date {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.entry-preview {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Bitácora — detalle ── */
.bitacora-detail { max-width: 720px; }

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--accent); }

.detail-date {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Contenido Markdown ── */
.bitacora-content { font-size: 0.9375rem; line-height: 1.75; }

.bitacora-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.bitacora-content h2 {
  font-size: 1.1875rem;
  font-weight: 600;
  color: #fff;
  margin: 1.75rem 0 0.625rem;
}

.bitacora-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.25rem 0 0.5rem;
}

.bitacora-content p {
  color: var(--text);
  margin-bottom: 0.875rem;
}

.bitacora-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bitacora-content code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-code);
  color: var(--text);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.bitacora-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.125rem;
}

.bitacora-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
}

.bitacora-content ul,
.bitacora-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.875rem;
}

.bitacora-content li { margin-bottom: 0.2rem; }

.bitacora-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background: var(--accent-dim);
  border-radius: 0 4px 4px 0;
}

.bitacora-content blockquote p {
  color: var(--text-muted);
  margin-bottom: 0;
}

.bitacora-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.bitacora-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.bitacora-content th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border: 1px solid var(--border);
}

.bitacora-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}

.bitacora-content tr:nth-child(even) { background: var(--bg-card); }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 0.875rem 2rem;
  text-align: center;
}

footer p {
  color: var(--text-muted);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  header  { padding: 0 1rem; }
  main    { padding: 1.25rem 1rem; }
  footer  { padding: 0.75rem 1rem; }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0;
    gap: 0.625rem;
  }

  .apps-grid { grid-template-columns: 1fr; }
}
