:root {
  --bg: #f5f7fa;
  --bg-elevated: #ffffff;
  --surface: #eef1f5;
  --ink: #0f1419;
  --ink-secondary: #3d4a5c;
  --muted: #6b7280;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --accent: #3b6ea8;
  --accent-hover: #2f5a8c;
  --accent-soft: rgba(59, 110, 168, 0.12);
  --accent-violet: #6d5f9a;
  --brand-ink: #0f1419;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --panel: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  --shadow-logo: 0 10px 30px rgba(15, 20, 25, 0.22);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --font-ui: "Geist Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection {
  background: rgba(59, 110, 168, 0.2);
  color: var(--ink);
}

.atmosphere {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -18%, rgba(59, 110, 168, 0.14), transparent 55%),
    radial-gradient(ellipse 45% 35% at 100% 0%, rgba(109, 95, 154, 0.08), transparent 50%),
    radial-gradient(ellipse 40% 30% at 0% 40%, rgba(8, 145, 178, 0.05), transparent 45%),
    linear-gradient(180deg, #fafbfc 0%, #f0f3f7 100%);
}

h1, h2, h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
}
.muted, .sub, .lede, .cache-line { color: var(--muted); }

/* Brand / logo — wordmark ENTIKMEDIA (asset 2×, display 1× = nítido en retina) */
.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  max-width: 256px;
  line-height: 0;
}
.logo-wrap--side {
  margin: 0;
  max-width: 200px;
}
.logo-wrap picture {
  display: block;
  width: 100%;
  line-height: 0;
}
.logo-img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  aspect-ratio: 256 / 31;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: #000;
}
.logo-img--lg {
  max-width: 256px;
  border-radius: 8px;
  box-shadow: var(--shadow-logo);
}

.login-brand {
  text-align: center;
  margin: 0 0 0.25rem;
}

.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* login */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  animation: fadein 0.5s ease;
}
.login-panel {
  width: min(400px, 100%);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 20px;
  padding: 1.85rem 1.75rem 1.55rem;
  display: grid;
  gap: 0.95rem;
}
.login-panel label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-secondary);
}
.login-panel input {
  border: 1px solid var(--border-strong);
  background: #fff;
  padding: 0.75rem 0.9rem;
  font: inherit;
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.login-panel input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-panel button[type="submit"] {
  margin-top: 0.25rem;
  background: linear-gradient(180deg, #4578b0 0%, var(--accent) 100%);
  color: #fff;
  border: 0;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform 0.15s ease, box-shadow var(--transition);
  box-shadow: 0 6px 16px rgba(59, 110, 168, 0.28);
}
.login-panel button[type="submit"]:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
}
.login-panel button[type="submit"]:active { transform: translateY(1px); }
.error { color: var(--danger); margin: 0; font-size: 0.9rem; font-weight: 500; }

/* app shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  align-items: start;
  animation: fadein 0.4s ease;
}
@media (min-width: 981px) {
  .app-shell {
    background-image: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.96) 0,
      rgba(255, 255, 255, 0.96) var(--sidebar-w),
      transparent var(--sidebar-w)
    );
  }
}
.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  padding: 1.1rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  align-self: start;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  z-index: 40;
}
.side-brand { display: grid; gap: 0.65rem; flex-shrink: 0; }
.side-brand-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.15rem;
}
.side-brand-meta strong {
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.side-brand-meta .muted { font-size: 0.75rem; font-weight: 600; }

.side-nav {
  display: grid;
  gap: 0.28rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
}
.nav-item {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-secondary);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(59, 110, 168, 0.28);
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
  flex-shrink: 0;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.main {
  padding: 1.25rem 1.75rem 3rem;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.topbar-titles { min-width: 0; flex: 1; }
.topbar-titles h1 { font-size: 1.55rem; }
.topbar-titles .sub { margin: 0.2rem 0 0; font-size: 0.9rem; }
.topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.cache-line { margin: 0; font-size: 0.8rem; }
.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-scrim {
  position: fixed; inset: 0;
  background: rgba(15, 20, 25, 0.35);
  z-index: 30;
  backdrop-filter: blur(2px);
}

.banner {
  border: 1px solid rgba(59, 110, 168, 0.18);
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(59, 110, 168, 0.1), rgba(255, 255, 255, 0.7));
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  color: var(--ink-secondary);
}
.banner strong { color: var(--ink); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  transition: transform 0.2s ease, box-shadow var(--transition);
}
.metric:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.metric .k {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}
.metric .v {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.3rem;
  color: var(--ink);
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.05rem 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.panel-spaced { margin-top: 1.25rem; }
.panel-head { margin-bottom: 0.9rem; }
.panel-head h2 { font-size: 1.05rem; }
.panel-head p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.86rem; }

.svc-list, .proj-list, .runtime-list, .undeployed { display: grid; gap: 0.55rem; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color var(--transition), background var(--transition);
}
.row:hover {
  border-color: rgba(59, 110, 168, 0.22);
  background: #fff;
}
.row.dense { grid-template-columns: minmax(0, 1.4fr) minmax(4.5rem, max-content) auto; }
.row .title { font-weight: 600; letter-spacing: -0.01em; }
.row .meta { font-size: 0.84rem; color: var(--muted); margin-top: 0.15rem; word-break: break-word; }
.actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.actions button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  padding: 0.38rem 0.65rem;
  cursor: pointer;
  color: var(--ink-secondary);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.actions button.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fef2f2;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
}
.pill::before {
  content: "";
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--muted);
  animation: pulse 2s ease infinite;
}
.pill.ok::before { background: var(--ok); }
.pill.bad::before { background: var(--danger); }
.pill.warn::before { background: var(--warn); }
.pill.idle::before { background: #94a3b8; animation: none; }

dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(820px, 94vw);
  background: #fff;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(15, 20, 25, 0.45); }
.logs-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); margin: 0;
}
#logs-body {
  margin: 0;
  padding: 1rem;
  max-height: 60vh;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: #0f1419;
  color: #e5e7eb;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell, .app-shell, .metric { animation: none; transition: none; }
  .pill::before { animation: none; }
  .login-panel button[type="submit"], .metric { transform: none; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(var(--sidebar-w), 86vw);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .metrics, .columns { grid-template-columns: 1fr 1fr; }
  .row.dense { grid-template-columns: minmax(0, 1fr) auto; }
  .row.dense > .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .topbar { align-items: center; }
}
@media (max-width: 640px) {
  .metrics, .columns { grid-template-columns: 1fr; }
  .main { padding: 1rem 1rem 2.5rem; }
  .topbar-titles h1 { font-size: 1.3rem; }
  .login-panel { padding: 1.35rem; border-radius: 16px; }
  .forms-row { grid-template-columns: 1fr; }
  .row-head { flex-direction: column; align-items: stretch; }
}

/* v0.4 — forms, tabs, toasts, tags */
.brand-mark {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.toolbar { margin-bottom: 1rem; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tab {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink-secondary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.stack-form {
  display: grid;
  gap: 0.75rem;
}
.stack-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-secondary);
}
.stack-form label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  grid-template-columns: none;
}
.stack-form input[type="text"],
.stack-form input:not([type]),
.stack-form input[type="password"],
.stack-form select {
  border: 1px solid var(--border-strong);
  background: #fff;
  padding: 0.65rem 0.8rem;
  font: inherit;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.stack-form input:focus,
.stack-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.stack-form button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.stack-form button[type="submit"]:hover { background: var(--accent-hover); }
.preview {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: #0f1419;
  color: #e5e7eb;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
.row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}
.proj-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.proj-list a:hover { text-decoration: underline; }
.proj-list code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--surface);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}
.error-banner {
  border: 1px solid rgba(220, 38, 38, 0.25);
  background: #fef2f2;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 500;
}
.toast-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: grid;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #0f1419;
  color: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: fadein 0.25s ease;
  border-left: 3px solid var(--accent);
}
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transition: opacity 0.25s ease; }
.actions button.danger {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
}
body.nav-open { overflow: hidden; }
body.nav-open .nav-scrim { display: block; }
.nav-scrim[hidden] { display: none !important; }

