:root {
  --bg-main: #0a0e17;
  --bg-card: #121826;
  --bg-card-hover: #172033;
  --border-color: #232f48;
  --border-focus: #06b6d4;
  --text-main: #f9fafb;
  --text-muted: #94a3b8;
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-crimson: #ef4444;
  --accent-purple: #8b5cf6;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header.foundry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-badge {
  font-size: 22px;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.35);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 11px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.env-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 24, 38, 0.8);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Layout */
.app-layout {
  display: flex;
  flex: 1;
}

/* Sidebar Navigation */
aside.sidebar {
  width: 250px;
  background-color: #0d1320;
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}

.nav-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.nav-btn.active {
  background-color: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  font-weight: 600;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.nav-icon {
  font-size: 16px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.sidebar-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

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

/* Content Area */
main.content-area {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  max-width: 1300px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.section-header {
  margin-bottom: 28px;
}

.section-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.section-desc {
  color: var(--text-muted);
  font-size: 14px;
}

/* Storefront Catalog Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 28px;
  margin-bottom: 32px;
}

.catalog-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.catalog-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.catalog-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

/* Dual Badge System (Blueprint D6) */
.badge-forged {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-foundry-direct {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  flex: 1;
}

.card-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 13.5px;
}

.card-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
}

.card-features li span {
  color: var(--accent-emerald);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.card-price {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.card-price small {
  font-size: 12px;
  font-weight: normal;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-foundry {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-foundry:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #172033;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #1e293b;
  border-color: #475569;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--accent-crimson);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background-color: var(--accent-crimson);
  color: #fff;
}

/* Card & Panels */
.panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Vault License Item */
.vault-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  background-color: #0b111e;
}

.vault-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.vault-product-name {
  font-size: 17px;
  font-weight: 700;
}

.node-list {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.node-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 0;
  color: var(--text-muted);
}

.node-id {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

/* Code & Output Blocks */
pre.code-block {
  background-color: #070a10;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #38bdf8;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 12px;
}

/* Modal Dialog */
dialog.checkout-modal {
  margin: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

dialog.checkout-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}
