/* ---- APP LAYOUT ---- */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.app-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}

.nav-links { display: flex; gap: 24px; align-items: center; }

.nav-link {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover { color: var(--fg); }
.nav-link--active { color: var(--accent); }

.app-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0;
  min-height: calc(100vh - 57px);
}

/* ---- CREATE PANEL ---- */
.create-panel {
  border-right: 1px solid var(--border);
  padding: 40px 32px;
  background: var(--bg-surface);
  overflow-y: auto;
}

.panel-header { margin-bottom: 28px; }
.panel-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.panel-sub { color: var(--fg-muted); font-size: 0.92rem; }

/* ---- FORM ---- */
.form-group { margin-bottom: 16px; }

.form-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  resize: vertical;
  min-height: 110px;
  transition: border-color 0.2s;
  outline: none;
}

.form-textarea:focus { border-color: var(--accent-soft); }
.form-textarea::placeholder { color: var(--fg-muted); }

.char-hint {
  text-align: right;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 6px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 13px 24px;
  transition: all 0.2s;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn--primary {
  background: var(--accent);
  color: #0a0a0c;
}

.btn--primary:hover { background: var(--accent-soft); }
.btn--primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.btn--ghost:hover { border-color: var(--accent-soft); color: var(--fg); }

.btn--full { width: 100%; }

/* ---- BLUEPRINT CARD ---- */
.blueprint-card {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(212,160,52,0.07), rgba(212,160,52,0.02));
  border: 1px solid rgba(212,160,52,0.2);
  border-radius: var(--radius);
  padding: 28px 24px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.blueprint-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.blueprint-systems {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.system-badge {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.system-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.system-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}

.system-arrow {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 14px;
}

.blueprint-steps { margin-bottom: 16px; }
.steps-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin-bottom: 10px;
}

.bp-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: step-counter;
}

.bp-steps-list li {
  counter-increment: step-counter;
  padding-left: 28px;
  position: relative;
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.5;
}

.bp-steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: #0a0a0c;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
}

.blueprint-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 0.85rem;
  margin-top: 12px;
}

.meta-key {
  font-weight: 600;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-val { color: var(--fg); }

/* ---- ALERT ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert--error {
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(220, 60, 60, 0.25);
  color: #e88;
}

/* ---- STATUS PANEL ---- */
.status-panel {
  padding: 40px 36px;
  overflow-y: auto;
}

.status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.status-summary { display: flex; gap: 12px; }

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  text-align: center;
  min-width: 64px;
}

.stat-pill--accent { border-color: rgba(212,160,52,0.25); }
.stat-pill--muted { opacity: 0.7; }

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
}

.stat-pill--accent .stat-num { color: var(--accent); }

.stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 64px 32px;
}

.empty-icon { font-size: 2.4rem; margin-bottom: 16px; opacity: 0.3; }
.empty-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-sub { color: var(--fg-muted); font-size: 0.9rem; }

/* ---- WORKFLOW CARDS ---- */
.workflow-list { display: flex; flex-direction: column; gap: 12px; }

.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  transition: border-color 0.2s, opacity 0.2s;
}

.workflow-card:hover { border-color: rgba(255,255,255,0.1); }

.workflow-card.is-paused { opacity: 0.6; }

.workflow-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.workflow-info { flex: 1; min-width: 0; }

.workflow-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workflow-systems { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.sys-chip {
  font-size: 0.75rem;
  font-family: var(--font-display);
  font-weight: 500;
  background: rgba(212,160,52,0.1);
  color: var(--accent);
  border: 1px solid rgba(212,160,52,0.2);
  border-radius: 5px;
  padding: 2px 8px;
}

.sys-arrow { color: var(--fg-muted); font-size: 0.8rem; }

.workflow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--active {
  background: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.5);
}

.status-dot--paused { background: var(--fg-muted); }
.status-dot--error { background: #e57373; }

.status-text {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.8rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover { border-color: var(--accent-soft); color: var(--fg); }
.run-btn:hover { border-color: #4caf50; color: #4caf50; }
.delete-btn:hover { border-color: #e57373; color: #e57373; }

/* Running pulse animation */
.icon-btn.is-running {
  animation: pulse 1s infinite;
  pointer-events: none;
  border-color: #4caf50;
  color: #4caf50;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.workflow-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.meta-item { display: flex; flex-direction: column; gap: 1px; }

.meta-k {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  font-family: var(--font-display);
}

.meta-v {
  font-size: 0.88rem;
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 500;
}

.meta-v--warn { color: #e57373; }

/* ---- RUN LOG ---- */
.run-log-section { margin-top: 8px; }

.run-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.run-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.run-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.run-status-dot--success { background: #4caf50; }
.run-status-dot--failed { background: #e57373; }
.run-status-dot--running { background: var(--accent); animation: pulse 1s infinite; }
.run-status-dot--pending { background: var(--fg-muted); }

.run-workflow-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 500;
}

.run-status-text {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.run-status-text--success { color: #4caf50; }
.run-status-text--failed { color: #e57373; }
.run-status-text--running { color: var(--accent); }
.run-status-text--pending { color: var(--fg-muted); }

.run-time {
  font-size: 0.78rem;
  color: var(--fg-muted);
  flex-shrink: 0;
  font-family: var(--font-display);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .create-panel { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
  .create-panel, .status-panel { padding: 24px 20px; }
  .status-header { flex-direction: column; }
  .workflow-card-top { flex-direction: column; gap: 10px; }
  .workflow-actions { align-self: flex-end; }
}
