:root {
  --bg-primary: #070c14;
  --bg-secondary: #0e1522;
  --bg-tertiary: #162032;
  --bg-card: rgba(14, 21, 34, 0.88);
  --border-color: rgba(56, 189, 248, 0.18);
  --border-focus: #38bdf8;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-gold: #f59e0b;
  --accent-rose: #f43f5e;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(14, 30, 48, 0.45) 0%, rgba(6, 11, 19, 0.95) 75%),
    url('/imgs/card-table-bg.svg');
  background-repeat: no-repeat, repeat;
  background-attachment: fixed;
  background-size: 100% 900px, 320px 320px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Return & Ecosystem Navigation Bar */
.subsystem-top-bar {
  background: rgba(7, 12, 20, 0.94);
  border-bottom: 1px solid var(--border-color);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.825rem;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.return-main-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: opacity 0.15s ease;
}

.return-main-link:hover {
  opacity: 0.85;
}

.brand-card-mini {
  width: 14px;
  height: 18px;
  border-radius: 2px;
  border: 1px solid var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.sub-divider {
  color: #334155;
}

.sub-current-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ecosystem-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.15s ease;
}

.ecosystem-link:hover {
  color: var(--text-primary);
}

.ecosystem-link.highlight {
  color: var(--accent-emerald);
  font-weight: 600;
}

/* User Session Pill in Bar */
.user-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  font-size: 0.75rem;
}

.user-avatar-mini {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name-label {
  color: #34d399;
  font-weight: 600;
}

.logout-link-mini {
  color: #94a3b8;
  text-decoration: none;
  margin-left: 0.25rem;
  font-size: 0.7rem;
  padding-left: 0.35rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transition: color 0.15s ease;
}

.logout-link-mini:hover {
  color: #ef4444;
}

/* Main Container & Card Table Layout */
.subsystem-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  position: relative;
}

.subsystem-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 3rem 2.5rem;
  max-width: 620px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
}

/* Corner Pips */
.card-pip {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pip-top-left {
  top: 1.25rem;
  left: 1.25rem;
}

.pip-bottom-right {
  bottom: 1.25rem;
  right: 1.25rem;
  transform: rotate(180deg);
}

.pip-rose {
  color: var(--accent-rose);
}

.pip-emerald {
  color: var(--accent-emerald);
}

.pip-gold {
  color: var(--accent-gold);
}

/* Emblem Wrap */
.subsystem-emblem-wrap {
  width: 110px;
  height: 140px;
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s ease;
}

.subsystem-emblem-wrap:hover {
  transform: translateY(-4px) scale(1.02);
}

.subsystem-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Typography */
.subsystem-heading {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 0.35rem;
}

.subsystem-host-badge {
  display: block;
  width: fit-content;
  margin: 0 auto 1.25rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.subsystem-summary {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 1.75rem;
}

/* Callout Notice Boxes */
.notice-box {
  background: rgba(14, 23, 38, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.notice-box.warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.25);
}

.notice-box.auth {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
}

.notice-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #f1f5f9;
}

.notice-title.warning {
  color: #fbbf24;
}

.notice-title.auth {
  color: #34d399;
}

.notice-text {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.notice-text strong {
  color: #ffffff;
}

/* Status Pill Row */
.status-pill-row {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.sub-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.sub-pill.active {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.sub-pill.gold {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* Action Buttons */
.action-buttons-group {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-suit {
  padding: 0.75rem 1.35rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  border: none;
}

.btn-cyan {
  background: var(--accent-cyan);
  color: #04121d;
}

.btn-cyan:hover {
  background: #7dd3fc;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.25);
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #032014;
}

.btn-emerald:hover {
  background: #34d399;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Authenticated Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}

.dash-panel {
  background: rgba(14, 23, 38, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
}

.dash-panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.dash-panel-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.dash-panel-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Footer */
.subsystem-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
